Results 1 to 2 of 2
Thread: Regular expression question
Dec 19, 2012, 14:05 #1
- Join Date
- Nov 2012
- 0 Post(s)
- 0 Thread(s)
Regular expression question
I'm reading a chapter in a book about regular expressions, and the author has written one which should match a particular text. There's only part of it that I have a quarrel with however. That part is looking for [sometexthere].
And the expression he wrote goes like this:
Okay, so first he escapes the square bracket - /\[ so he'll find that.
Then he uses the round brackets (()) to group the text in the middle, so that later it can be referred to as $1.
Then he uses [^\]]+ to state that he wishes for there to be text that isn't a squared closing bracket, and then he simply adds the closing bracket. Why doesn't he escape the last bracket?