Re: how does this regular expression works

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13 July 2011 14:04, Shahriyar Imanov <shehi@xxxxxxxxxxx> wrote:
> \<head.*?\>(?P<head_tag_innerHTML>.*?)\<\/head\>



<head.*?>(?P<head_tag_innerHTML>.*?)</head>

Options: case insensitive; ^ and $ match at line breaks

Match the characters “<head” literally «<head»
Match any single character that is not a line break character «.*?»
   Between zero and unlimited times, as few times as possible,
expanding as needed (lazy) «*?»
Match the character “>” literally «>»
Match the regular expression below and capture its match into
backreference with name “head_tag_innerHTML”
«(?P<head_tag_innerHTML>.*?)»
   Match any single character that is not a line break character «.*?»
      Between zero and unlimited times, as few times as possible,
expanding as needed (lazy) «*?»
Match the characters “</head>” literally «</head>»


Created with RegexBuddy


Escaping < > ? at the wrong time is simply a redundancy. Learning when
to escape is just like learning a new language.

You only need to escape anything if you need it to be a literal character.

e.g.

something.html vs something\.html


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux