Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

正则表达式 #25

Open
374632897 opened this issue Aug 11, 2017 · 1 comment
Open

正则表达式 #25

374632897 opened this issue Aug 11, 2017 · 1 comment

Comments

@374632897
Copy link
Owner

No description provided.

@374632897
Copy link
Owner Author

374632897 commented Aug 11, 2017

获取一个 html元素的属性

const html = `<input type="text" class="form-control" style="width:248px;" value="点菜测试" data-reactid=".sceo9k633s.2.1.1.0.3.1.0.0">`;
html.match(/([\w]+)\s*?=\s*?(["'])([\s\S]*?)\2/g).map(item => item.slice().split('=').join(' => '))
// ["type => "text"", "class => "form-control"", "style => "width:248px;"", "value => "点菜测试"", "reactid => ".sceo9k633s.2.1.1.0.3.1.0.0""]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant