Hello,
I just made the experience that RegExps are WORN (write once, read never). I actually got help in this forum for the following RegExps, but unfortunately can not "read" them anymore. Can anybody give me a detailed, step by step description of the RegExps, so I really can understand the pattern?
preg_match_all('#^descr:\s*(.*?)\s*$#m', $array[3], $matches);
preg_match('#^\s*([^\s]+?)\s+(.*?)\s*$#s', $array[3], $matches);
Thanks a lot,
visionmaster
Understanding RegExps
Moderator: General Moderators
-
visionmaster
- Forum Contributor
- Posts: 139
- Joined: Wed Jul 14, 2004 4:06 am
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
1. find all lines that start with the string 'descr:' followed by any number of spaces, remember all characters outside of trailing spaces until the end of the line.
2. remember the first word (excluding leading spaces), remember the following until the end of the string (excluding leading and trailing spaces)
2. remember the first word (excluding leading spaces), remember the following until the end of the string (excluding leading and trailing spaces)
-
visionmaster
- Forum Contributor
- Posts: 139
- Joined: Wed Jul 14, 2004 4:06 am