Actually, now that I think about it a little more....

Is it safe to assume that you have well-formed XML (even though you
don't want to parse it), that the <tag> element has no child elements,
and finally that there are no comments or CDATA blocks in the file?

If so, you can look for <tag>([^<]*[^0-9][^<]*)</tag> and that should
get you what you want.

I still think a better solution would be to SAX is through a pipeline
to modify it stream-wise, because any time you're manipulating XML in
a non-XML-aware fashion you're just asking for pain.  But if my stated
assumptions are valid and you're confident that they will always
remain so, that regex should work.

If those assumptions aren't valid or you don't feel comfortable
relying on them, you'd gonna need an XML-aware mechanism to process
the XML.

cheers,
barneyb

On Mon, Mar 7, 2011 at 1:48 PM, Ian Skinner <[email protected]> wrote:
>
> On 3/7/2011 11:40 AM, Barney Boisvert wrote:
>
> Well, I'm not really looking for a new XML parser at this time as
> ColdFusion is not expected to parse the file.  I am only trying to clean
> up an example, demonstration file that the can then be used for other
> testing purposes.
>
>> Specifically one that supports lookahead and lookbehind to anchor
>> yourself.
>
> Ok, but I can not see how to use lookahead (which does exist without
> going into the Java) or lookbehind to do what I need.  As best as I can
> tell, those would be great to get some of the numbers, if there where
> non-digit characters in the string.  But I do not see how to match the
> ENTIRE string, IF one or more of the characters in the string are a
> character.
>
> I.E.
>
> <tag>19984798</tag>  NOT a match.
> <tag>18435A89</tag> IS a match, return 18435A89.
> <tag>Z8457920</tag> IS a match, return Z845792.
> <tag>7493841-</tag> IS a match, return 7493841-
> ETC.
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/regex/message.cfm/messageid:1253
Subscription: http://www.houseoffusion.com/groups/regex/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/regex/unsubscribe.cfm

Reply via email to