Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: Forming a Regular Expression for Quotes


Message #1 by UltimateMSTS@a... on Tue, 18 Jun 2002 17:37:20
Hi,

I'm designing a "news centre" application that will be able to display 
certain quotes, surrounded by <<< and >>> (in this case "and" would be in 
a special format). I can't use any HTML tags for a variety of reasons.

So, I formed this reg. expression:

<<<([^>]+)>>>

In other words, anything contained within the <<< >>>, but without 
containing >. I would leave out the brackets entirely, but obviously I 
need them to keep the text between the delimiters (and stored as \1 in the 
regexp).

BUT, this fails, and I'm left with plain text, looking like the following:
<< text >>>
(note only the double << at the beginning).

If you have any ideas about what I'm doing wrong, or any suggestions on 
how to put the code right, please help. I've tried the regexp with [^\(] 
in it, and this works fine (obviously except for where there are brackets, 
which is in almost all quotes!)

Thanks.

  Return to Index