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

修复Options正则 #562

Merged
merged 3 commits into from
Apr 22, 2020
Merged

修复Options正则 #562

merged 3 commits into from
Apr 22, 2020

Conversation

RickCole21
Copy link
Contributor

bug场景

image
image
输入 xxx(xxx)形式的字符串会报错

bug原因

input.replace(/([\$\^\*\+\-\?\.\(\)\|\[\]\\])/, '\\$1')

// 这里没加 g 标识,所以只会replace第一个,如下:
// aaa(bbb) --> aaa\(bbb)

aaa\(bbb)new RegExp 时会报错

解决方案

补充标识符

@RickCole21 RickCole21 requested a review from 2betop April 22, 2020 12:18
@2betop 2betop merged commit d8ddb47 into baidu:master Apr 22, 2020
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

Successfully merging this pull request may close these issues.

2 participants