mb81 Posted February 3, 2007 Share Posted February 3, 2007 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 More sharing options...
effigy Posted February 3, 2007 Share Posted February 3, 2007 You're using a pipe as the delimiter and as the alternation metacharacter. I recommend changing your delimiter to something that is not in regex or your data; perhaps a percent sign. Link to comment https://forums.phpfreaks.com/topic/36856-unknown-modififer/#findComment-175948 Share on other sites More sharing options...
mb81 Posted February 3, 2007 Author Share Posted February 3, 2007 You're using a pipe as the delimiter and as the alternation metacharacter. I recommend changing your delimiter to something that is not in regex or your data; perhaps a percent sign. Good answer - SOLVED! Link to comment https://forums.phpfreaks.com/topic/36856-unknown-modififer/#findComment-175983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.