![]() |
Regex help.
I don't know if this is the right place to post this.
Ok I've got this code PHP Code:
As you can see the "a name" is related the first character of the string. I'm using a regex search and replace function and I need to be able to change this: PHP Code:
PHP Code:
Can you guys figure out how to do this as regex is a very weak point for me. |
what are you using to generate this code? is it php? if so, lets have a look!
|
At the moment it is static but it will be developed to php soon. At the moment I just need the regex statement thanks.
|
what i mean is how is the 'a' getting to be there?? is it dynamic, from a database, piece of code/script? do you own the site? If 'static' can't you just remove it? Why do you need regex?
Regards, Phil |
I placed the "a" there. Problem is there is over 3000 lines. I can't manually append <a href="whatever"> to the start and </a> to the end. Remeber also that "whatever" has to equal the string inside the <li> tags.
|
If my request seems impossible I can remove all tags and just have whatever is inside the <li> tags so instead of:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
give me 2 mins
|
PHP Code:
Code:
<li><a href="http://www.google.com.au/search?q=(blah)">(blah)</a><li> |
p.s. a man once told me ANYTHING is possible and NOTHING is impossible with programming, you just don't know how yet.
|
also a better way would be not to use preg_replace but preg_match_all, the use the data to urlencode the data before sticking in the url.
|
PHP Code:
Code:
<li><a href="http://www.google.com.au/search?q=%28blah%29">(blah)</a></li> |
Works when I place the list in the file but when I try to include it in a txt file it doesn't work.
|
are you trying:
PHP Code:
|
Yes and all I'm getting is a blank page.
Having it directly in the page works though. |
Post your existing code, as is.
|
| All times are GMT +1. The time now is 10:22 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.