Thursday, 15 April 2010

Perl : Decoding Regex -


I highly appreciate if someone can help me understand the following.

  = ~ / (? & Lt;! [\ W.]) ($ Val) (?! [\ W.]) / Gi)  
< P> This is what I picked up, but I can not understand it. / P>

Lookaround: (? = A) for a lookhead, ?! for the negative lookhead, or ? & Lt; No and and to Regex (that is, the string that matches the contents of the variable $ val ) Strong> The word is surrounded by letters or points.

By typing $ val in parentheses, remembering the corresponding matching part in $ 1 .

See for details.

Note that = ~ is not a part of regex, it is a "binding operator".

Similarly, gi) is part of something larger. g means matches are globally , which match on the basis of context , and i matches The case makes insensitive (which could only affect $ val) in the entire expression bracket, perhaps, but we can not see the opening.


No comments:

Post a Comment