Forum Moderators: coopster

Message Too Old, No Replies

regular expression help

more complicated reg expression.

         

philestine

4:55 pm on Mar 2, 2006 (gmt 0)

10+ Year Member



hi, i need 2 use regular expression to represent the values between the title tags. below is only an example but it uses all the characters that are on the site.

<title>someurl.co.uk ¦ Ocean Village</title>

basically i am using DreamWeaver site wide find and replace function to select all the title tags and replace with a php echo statement. I have tried a few things but havent quite grasped the more complicated reg expression.

coopster

7:57 pm on Mar 2, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, philestine.

What have you got so far?

philestine

9:17 am on Mar 3, 2006 (gmt 0)

10+ Year Member



I guess it is more syntax help i need, am i right in thinking that \w is [a-zA-Z0-9_] which i have used before it in latter example to replace varibles in my scripts when using them for a new project.

i tried something like [\s,.¦\w] but i dont know what order the characters are going to appear in! as it used for verification i guess you can make sure each section has a correct value like. [a-zA-Z0-9_][\s.][a-zA-Z0-9_] so would that match 9998889.abcde12? i just need to select everything between the 2 tags!

philestine

10:24 am on Mar 3, 2006 (gmt 0)

10+ Year Member



sorted used <title>.*</title> replace 983 documents in 3.5mins!

but any comments / tips on regular expression will go down well!

coopster

12:00 am on Mar 4, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Good for you. Searching this site will usually turn up some good reads on just about every subject, including regular expressions.

The PHP Forum Library [webmasterworld.com] has a thread about Learning PHP - Books, Tutorials and Online Resources [webmasterworld.com] in which you will find some regular expression (regex) information.