1) I turned on], but the page does not do this. is it true that we should not include]? (apparently, I have no doubt about this page, but since my implementation is in javascript, not C # / vb ..)
] you only need to escape inside the character set. This list is also missing - which sometimes needs to be escaped inside character sets. For example, to create a character set containing character spaces, a dash, and the letter A, you will need to avoid - thus: /[ \-A]/ or move the line to the side: /[- A]/ .
Of the characters listed above, only the tags ] , - , ^ and \\ must be escaped in character sets. ^ you only need to escape inside the character set if it is in the character set and at the beginning.
If you want to include the regular expression text in literal form, /.../ instead of new RegExp("...") , you also need to remove the string terminator characters: code point U + 000A, U + 000D, U + 2028, U + 2029, and the character / , if outside the character set.
2) I missed the #. is character # character in javascript regex?
No, # not special in JavaScript.
Mike samuel
source share