LMarie Posted December 10, 2009 Share Posted December 10, 2009 hi.. my question is how do you use preg replace to remove paranteses and their content? the sentence is in this format test, test (test, test ,1 ,2), test i want to count commas but not the ones in paranteses so my solution is to remove that part of the sentence. Anyone that can help me with this? Thanks in advance Quote Link to comment Share on other sites More sharing options...
cags Posted December 10, 2009 Share Posted December 10, 2009 Is this by any chance something to do with SQL statements? Also is it a college assignment, because we've had a very similar questions at least two other times recently. Quote Link to comment Share on other sites More sharing options...
LMarie Posted December 10, 2009 Author Share Posted December 10, 2009 is not a college assignement.. im trying to make a sql table that contains sql querys and display the results in a html table when choosen. But i need to determine how many commas there is between select and from so that i can how many rows the table needs so i need to remove the paranteses and their content. Quote Link to comment Share on other sites More sharing options...
salathe Posted December 10, 2009 Share Posted December 10, 2009 Wouldn't it be easier to use the results to determine how many "rows" (columns?) are needed? Quote Link to comment Share on other sites More sharing options...
LMarie Posted December 10, 2009 Author Share Posted December 10, 2009 Maybe but iv done everything else so this is the only part missing. Does anyone know the regex to match paranteses and their text content? Quote Link to comment Share on other sites More sharing options...
cags Posted December 10, 2009 Share Posted December 10, 2009 Check out this thread, theres several different fairly elegant solutions discussed, including finding alias names etc if required. Quote Link to comment Share on other sites More sharing options...
LMarie Posted December 10, 2009 Author Share Posted December 10, 2009 Thats just what i needed Thank you for the help Quote Link to comment Share on other sites More sharing options...
cags Posted December 10, 2009 Share Posted December 10, 2009 Excellent, don't forget to click the 'Mark Solved' button (found bottom left of threads you start). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.