I am parsing a list of URLs
the urls where before
http://www.example.com/j_d.php?j_i=1111
now they are
http://www.example.com/j_d/1111/random_text
Before I had this match pattern
if (preg_match_all('/href=["\']j_d\.php\?j_i=(\d+)/', $html, $m)) {
Now I am trying to figure out the new one
if (preg_match_all('/href=["\']j_d\(\d+)\*', $html, $m)) {
but cannot! Help me out please:!)
regex help
Moderator: General Moderators
Re: regex help
I could help you out by telling you to go post in the Regex forum, or I could tell you to learn regular expressions before trying to use them, but I'll do something else instead:
Code: Select all
#href=["']j_d/(\d+)#Re: regex help
sorry did not realize that there was a regex forum.
still not working :
if (preg_match_all('/href=["\']j_d\(\d+)#\', $html, $m)) {
Warning: preg_match_all() [function.preg-match-all]: No ending delimiter '/'
if (preg_match_all('/href=["\']j_d\\(\d+)#/', $html, $m)) {
Warning: preg_match_all() [function.preg-match-all]: Compilation failed: unmatched parentheses at offset 25
if (preg_match_all('/href=["\']j_d/\(\d+)#/', $html, $m)) {
Warning: preg_match_all() [function.preg-match-all]: Unknown modifier '\'
if (preg_match_all('/href=["\']j_d\(\d+)/#', $html, $m)) {
Unknown modifier '#'
Thanks for all you help.
Wishing you all a good 2009!
still not working :
if (preg_match_all('/href=["\']j_d\(\d+)#\', $html, $m)) {
Warning: preg_match_all() [function.preg-match-all]: No ending delimiter '/'
if (preg_match_all('/href=["\']j_d\\(\d+)#/', $html, $m)) {
Warning: preg_match_all() [function.preg-match-all]: Compilation failed: unmatched parentheses at offset 25
if (preg_match_all('/href=["\']j_d/\(\d+)#/', $html, $m)) {
Warning: preg_match_all() [function.preg-match-all]: Unknown modifier '\'
if (preg_match_all('/href=["\']j_d\(\d+)/#', $html, $m)) {
Unknown modifier '#'
Thanks for all you help.
Wishing you all a good 2009!
Re: regex help
Look harder at what I posted. All you have to do is wrap it in quotes.