the pattern (\n|.)* and PHP Segmentation Fault
- by Joe Jr Yamut
the pattern:
(\n|.)*
what it does:
this is a nice regular expression pattern that spans multiple lines.
example:
pattern used – <label>Address:(\n|.)*<label>Website:
<div id=’cominfo_hdr_div’>Company Information</div>¶
¶
<label>Address:</label><br>¶
33rd Flr. PBCom Tower, Ayala Ave., Corner Herrera St.<br>Makati City, Metro Manila <br><br>¶
<label>Website:</label><br>¶
http://www.example.com <br><br> ¶
<label>More Information</label><br>¶
—
this is very useful for parsing text from data with a repeating pattern. just queue up the data source in a loop, run the regular expression pattern through it and you should have that particular text you want in no time. yes?
Nope! at least for me it didn’t. it got me something else instead.
from my repeated manual tests using patterned strings spanning multiple lines similar to the example above, this regular expression would work. however, when i started feeding the actual data for parsing in a loop, i got a PHP Segmentation Fault at some point. the data source isn’t that huge. about 15 – 30 KB each in size, and close to a thousand. sometimes it went through once or twice without an error, but after several iterations in the loop it always went down to a Segmentation Fault.
what seems to be the matter?
Similar Posts:
- > KMail not sending. ..STUPID Me! August 13, 2006
- > Help Fund Novacut – Opensource Pro Video Editor July 24, 2011
- > I Finally Shrunk My AWS EBS Volume September 17, 2021
- > set squid proxy outgoing IP January 26, 2007
- > Quickly Get JSON Values Via Jayway JsonPath March 31, 2021
the pattern: (\n|.)* what it does: this is a nice regular expression pattern that spans multiple lines. example: pattern used – <label>Address:(\n|.)*<label>Website: <div id=’cominfo_hdr_div’>Company Information</div>¶ ¶ <label>Address:</label><br>¶ 33rd Flr. PBCom Tower, Ayala Ave., Corner Herrera St.<br>Makati City, Metro Manila <br><br>¶ <label>Website:</label><br>¶ http://www.example.com <br><br> ¶ <label>More Information</label><br>¶ — this is very useful for parsing text from…