Current location: Hot Scripts Forums » Programming Languages » PHP » [SOLVED] regexp for forward slashes


[SOLVED] regexp for forward slashes

Reply
  #1 (permalink)  
Old 01-28-09, 05:16 AM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] regexp for forward slashes

Cant seem to find any help with this and I'm no good with regexpression but this was my attempt


PHP Code:



//ie [^<]/
$result preg_replace('/[^<]\//'''$subject); 
I need to replace all instances of / forward slash except where they are inside angle brackets ie </span> </div>

The above for some reason almost does it but regexbuddy highlights the letter before the backslash too (I cant see why it would do that: highlight all "/" except [^] when its not an "<" I dont see the oh and can you highlight the previous letter to that too, thanks )

Any suggestions?

Cheers
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
  #2 (permalink)  
Old 01-28-09, 05:25 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
PHP Code:

'~(?<!<)/~' 

Look around.
Reply With Quote
  #3 (permalink)  
Old 01-29-09, 03:48 AM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Nico, I've never come across that expression before in my regexbuddy. The site looks good too.

regexbuddy says : The regular expression does not match the test subject but after trying it in my code it worked! So regexbuddy is not that good, can you recommend any other application that would help me build expressions?

Thanks very much, lifesaver!
Dal
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use xmlhttp and regexp to get information fredda ASP 1 01-07-09 04:18 PM
Javascript RegExp assistance required (paid offer) BosDev Job Offers & Assistance 2 09-16-05 07:41 PM
Search Keyword Textfield SummerL PHP 2 07-28-05 02:48 AM
RegExp Mister B. ASP 1 03-09-05 05:31 AM
Problem with slashes in forms startanisp PHP 3 02-02-04 07:03 AM


All times are GMT -5. The time now is 08:27 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.