If every <prefix:tag> needs to have a </prefix:tag>, count both and if the
numbers don't match, one is missing. Of course this only tells you that
there is one missing, not where in the file it is.

Also, I *think* REMatch() in CF8 will do the same thing as cf_reextract.

Adrian

-----Original Message-----
From: Peter Boughton
Sent: 02 November 2007 18:24
To: RegEx
Subject: Re: Finding unclosed XML tags?


Thanks, that sounds promising - although I'm about to go on holiday so it
will be a while before I can look at it. :)

On 11/2/07, Claude Schneegans <[EMAIL PROTECTED]> wrote:
>
> >>Getting the initial tag is easy enough ( <prefix:([a-z_]+)[^>]*[^/]>
> ), but I can't think how to check for a lack of closing tag.
>
> As Ben says, it's pretty hard to find absence of something using Regexp.
> Have a look at CF_REextract:
> http://www.contentbox.com/claude/customtags/REextract/testREextract.cfm
> You can easily extract all strings between <prefix... and </prefix  or
> <prefix...or end of text
>
> For instance, try
> http://www.contentbox.com/claude/customtags/REextract/testingREextract.cfm
> - enter <prefix:([a-z_]+)[^>]*[^/]> in RE1,
> - enter </prefix>|<prefix:([a-z_]+)[^>]*[^/]>|$ in RE2
> - enter this in Sample Text:
>
> This is <prefix:tag...> a test to check
> if </prefix> are missing <prefix:tag...> somewhere <prefix:tag...>  in
> the text
> <prefix:tag...>  in the text
>
> Now, if any occurrence does not have </prefix> in string3, it is an
> unclosed <prefix.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1081
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21

Reply via email to