Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Laurens #1
RegEx: can't figure this out!
Hello everyone, I have been trying for days to get this right but I can't seem
to grasp it: I'm trying (ofcourse) to match a substring inside a string, but
want to skip other occurrences of the same substring. I'll give an example to
stay comprehensible: My string: Some text<font color='red'>I'm building a new
front here where the frontier used to be</font> some more text. I'm trying to
match 'ont', but only the occurrences outside the tags, ie, it has to skip the
'ont' in '<font color=...>' and '</font>', but it has to come up with the 'ont'
in 'front' and 'frontier'. I found RegEx that strip the tags, but I want to
keep them, just not show up in the results. I want to skip the tags, not remove
them. I would be very grateful to those who can help help me, thanks in
advance. Laurens Bloem
Laurens Guest
-
Trying to figure out CF and IIS
Hello, I just found out about the free CF Developer, so I wanted to download, install, and see if I could learn it. I'm not sure what I've done... -
Help me figure out how I did this!!!
Ok, so without being able to show anyone, what I have is a highly pixelated black and white head shot of myself. Mosaic, except w/ no grout and all... -
See if you can figure this one out....
I have a simple ASPX page being hosted on our ISP. The page contains 2 textboxes, and one button: http://www.jonkar.ca/nora/xtest.aspx You put... -
Trying to figure this out
Just trying to figure this out but can't. Can someone help with this effect? ... -
Need to figure this one out
Hey all Looks like I'm officially the art guy in the band now.....SO I've been asked to design something with this concept: ... -
-
Adam Cameron #3
Re: RegEx: can't figure this out!
> Some text<font color='red'>I'm building a new
This is tricky, because - as near as I can tell - you can't tell a regex to> front here where the frontier used to be</font> some more text.
NOT match a specific character sequence. You can tell it to match a
something that isn't a character (or a set of characters), but not a set
sequence.
You could easily enough get it to match [^f]ont, but that would also skip
the word "font" (and anything else with that sequence in it) within the
text, too.
I'd probably swap out <[/]?font matches for something else, then deal with
your "ont" issue, then swap the font tags back in again. Pity to do it in
three steps, but I can't think of another way of doing it.
--
Adam
Adam Cameron Guest
-
Laurens #4
Re: RegEx: can't figure this out!
Hi Adam, thanks a lot for your reply.I thought of that, but then I'm left with
the problem that it still finds <TD class='content'> for example, and I need to
skeep all tags... Do you think I can find every ont in tags, so between < andwork, using one step to change every 'ont' that's inbetween < and > to>. If I can REreplace those by some strange string, than your solution will
something like '___temporarily_changed___', then a second step that simply
replaces every ont still in the string, then a third to change back all the
'___temporarily_changed___' to 'ont'. Thanks for your help, I'll try to find
how to find 'ont's within tags. If that's easy to you, please answer back.
Kind regards, Laurens
Laurens Guest
-
Adam Cameron #5
Re: RegEx: can't figure this out!
>Do you think I can find every ont in tags, so between < and
(<[^>]*)(ont)([^>]*>)> work, using one step to change every 'ont' that's inbetween < and > to>>. If I can REreplace those by some strange string, than your solution will
> something like '___temporarily_changed___', then a second step that simply
Seems to work. Only tested it for about 30sec, though.
All this begs the question... WHY are you wanting to change all instances
of ONT to something else? ;-)
--
Adam
Adam Cameron Guest
-
Laurens #6
Re: RegEx: can't figure this out!
Hi Adam, I took 'ont' as an example to stay comprehensible. What I'm doing is
writing a HighLight UDF that looks for a search phrase (entered by the user)
and highlights it in the found text. To highlight the occurrences of the search
phrase in the found text, I replace the match with <span class='highlight'>the
match</span>. But that is highly undesirable if the text contains tags, because
they suddenly show up where they shouldn't looking highlighted. You could get
something like <f<span class='highlight'>ont</span> color='red'>This is the
fr<span class='highlight'>ont</span></f<span class='highlight'>ont</span> But
if I explained that, and then asked my question, I would have lost everybody
long before they got to the question ;-) Have a good weekend!! Laurens
Laurens Guest



Reply With Quote

