Jump to content

[Regexp] Quoting special characters in square brackets


Luke

Recommended Posts

Do special characters (e.g. ".") need to be quoted when they're inside square brackets?

Unless I'm missing something, it should not be necessary to quote them (i.e., they're always treated literally except for "[" and "]")...

But if that's really the case, then I cannot understand why the following string

{none,1,\(1\|3\),\(1\|3\|5\),\(1\|3\|5\|7\)}

DOES NOT match

^{[^.,;{}%TAB%]+,[^.,;{}%TAB%]+\(,[^.,;{}%TAB%]+\)*}$

 

Edited by Luke
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...