Jump to content

Unknown modififer


mb81

Recommended Posts

Hey everyone, I am writing my first really hardcore regex and I ran into a problem.

 

What I am doing is trying to parse elements out of a table that is in a standard format.

 

I built the regex from left to right slowly working through each pattern and I got to this point that worked:

preg_match("|<tr><td>(\d{2}/\d{2}/\d{0,4})</td><td>(\d{4}\*?)</td><td>([\d\w ]*)</td><td>([\d\w ]*)</td><td>|",$thisfile,$matches);

When I added the next section to test for "TBA" or a time (##:## or #:##), shown here:

preg_match("|<tr><td>(\d{2}/\d{2}/\d{0,4})</td><td>(\d{4}\*?)</td><td>([\d\w ]*)</td><td>([\d\w ]*)</td><td>(TBA|\d{1:2}))|",$thisfile,$matches);

It gave me this error: unknown modifier '\', it doesn't seem to like it after the or '|' operator, I tried to switch them and it didn't like that either, saying the "T" was an unknown modifer. There is nothing in the tutorials that I am referencing that say anything about it. Can someone help?

 

Thanks,

Matt

 

Link to comment
https://forums.phpfreaks.com/topic/36856-unknown-modififer/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.