1. You only need the brackets for the subexpression if you want to do something with
it. (Like isolating the title or eliminating the tags with back referencing).
Otherwise, you can drop them. It's not a problem if you leave them there.
2. I dont really see why your first one didn't match <title>untitled</title>. It was a
little weard because it wouldn't match a title like <title>Hello there</title> because
of the space between Hello & there.
I think what you wanted to write was <[ ]*title[ ]*>[ [:alnum:][:punct:]]*</[ ]*title[
]*>.
This would have the same problems as "<[ ]*title[ ]*>(.*)</[ ]*title[ ]*>" . It would
match two or more title tags as one string (see my original message).
PS I don't know where you get your regex examples from, but there is a ppt on
houseoffusion (http://www.houseoffusion.com/RegEx.ppt) and one on cfugorama
(http://www.cfugorama.com/cfugorama/codelibrary/Regular-Expressions.cfm)
Hope that helps
-----Oorspronkelijk bericht-----
Van: Kola Oyedeji [mailto:[EMAIL PROTECTED]]
Verzonden: vr 1-2-2002 17:57
Aan: CF-Talk
CC:
Onderwerp: RE: another quick regular expression question
Pascal
question regarding this regex:
<[ ]*title[ ]*>([^<]*)</[ ]*title[ ]*>
1. Do I need the subexpression brackets if so why?
2. SO is it because I did not account for an opening < that my regex didnt
work?
Thanks
Kola Oyedeji
Web developer
Macromedia Certified Advanced ColdFusion 5 Developer
ekeda ltd
http://www.ekeda.co.uk
(+44)020-8429-7300
> -----Original Message-----
> From: Pascal Peters [mailto:[EMAIL PROTECTED]]
> Sent: 01 February 2002 16:39
> To: CF-Talk
> Subject: RE: another quick regular expression question
>
>
> This is incorrect. the regexp below will match "hello world". Try
> running the code below
> <cfoutput>#ReFindNoCase("[ ]*hel[ ]*lo[ ]*wo[ ]*rld"," Hello
> World")#</cfoutput>
>
> For the original question:
>
>
> this will match your title if there is no < in the title.
>
> The expression "<[ ]*title[ ]*>(.*)</[ ]*title[ ]*>" will match the
> title if you have only ONE <title> tag. If you have more, it
> will match
> everything from the first <title> to the last </title>
>
> Pascal Peters
> Certified ColdFusion (5.0) Advanced Developer
> Certified Web Developer
> Macromedia Certified Instructor
> LR Technologies, Belgium
> Tel +32 2 639 68 70
> Fax +32 2 639 68 99
> Email [EMAIL PROTECTED]
> Web www.lrt.be
>
>
>
> -----Original Message-----
> From: Steve Oliver [mailto:[EMAIL PROTECTED]]
> Sent: vrijdag 1 februari 2002 17:17
> To: CF-Talk
> Subject: RE: another quick regular expression question
>
>
> I don't think it works that way with spaces.
>
> If I have the string "hello world"
>
> And do a regexp for
>
> [ ]*he[ ]*llo[ ]*wor[ ]*ld[ ]*
>
> I don't believe that will work either,
>
> But this way should
>
> hello[ ]*world
>
> Or
>
> hello[[:space:]]*world
>
>
> ______________________
> steve oliver
> atnet solutions, inc.
> http://www.atnetsolutions.com
>
>
>
______________________________________________________________________
Why Share?
Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists