WhiteAvenger Posted March 10, 2009 Share Posted March 10, 2009 (edited) Hi,I have the following code:Func _getFood($day,$time) $days = StringRegExp($matches1,"<tr>.*?</tr>",1) _ArrayDisplay($days) EndFuncThe value of $matches1 is:<table id='menu'><tr><td></td><th>Sunday</th><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th><th>Saturday</th></tr><tr><th>Breakfast</th><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><th>Brunch</th><td>Sunday brunch</td><td></td><td></td><td></td><td></td><td></td><td>Brunch</td></tr><tr><th>Lunch</th><td></td><td>Pork chop, orange & gingerYYYXXXMoroccan vegetable tangine with cous-cous</td><td>Breaded turkey, lemon & caper butterYYYXXXChinese style stuffed peppers</td><td>Smoked fish dauphinoiseYYYXXXLeek & red leicester with herb scone</td><td>Oriental chickenYYYXXXTagliatelle, broccoli & mushroom sauce</td><td>Salmon wrapped in filo with tapenadeYYYXXXNut roast</td><td></td></tr><tr><th>Dinner</th><td></td><td>Spaghetti bolognaiseYYYXXXTomato, goats cheese & basil tart</td><td><font color="red">Curry night</font></td><td><font color="red">Burger night</font></td><td>Yet another...<BR><font color="blue">Formal hall</font></td><td>Chicken risottoYYYXXXPolenta & roasted vegetables</td><td></td></tr><tr><th>Notes</th><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>Hence the Regexp should (in theory) return several matches - each complete <tr></tr> "bracket".However, for some reason, it only ever returns the first result.I have no idea why - can anyone help me on this?Running StringRegExpReplace with the same regular expression worked fine - all the <tr></tr> tags with content were replaced.But StringRegExp doesn't work...Thanks,--WhiteAvenger Edited March 10, 2009 by WhiteAvenger Link to comment Share on other sites More sharing options...
Authenticity Posted March 10, 2009 Share Posted March 10, 2009 Change the last parameter of StringRegExp to 3, read more in the help file. Link to comment Share on other sites More sharing options...
WhiteAvenger Posted March 10, 2009 Author Share Posted March 10, 2009 Change the last parameter of StringRegExp to 3, read more in the help file.Thanks, that works.What is the difference between "matches" and "global matches"? Link to comment Share on other sites More sharing options...
Authenticity Posted March 10, 2009 Share Posted March 10, 2009 That after there is an overall match (which is the most preferred result) the not global stop and return a result if there is one. The global capture it but continue with the rest of the string until the end of the string has been reached, thus may report multiple matches. Link to comment Share on other sites More sharing options...
WhiteAvenger Posted March 10, 2009 Author Share Posted March 10, 2009 Alright, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now