As a very quick 'off the top of my head thing' it might help to think of
four cases:

Xyour textY = where X is not a [ and Y is not a ] - tag
[your text]  = already tagged - ignore
[your textX = where X is not a ] - partial tag ignore
Xyour tag] = where X is not a [ - partail tag ignore


So in fact only case one is really of interest.

Does that narrow down the regex pain :-)

"[^\[]your text[^\]]" something like that? (not tested)

On 9/29/06, Andy Matthews <[EMAIL PROTECTED]> wrote:
>
> A co-worker of mine is using CFWiki for a project of his and he has a
> question about something. Here's his email to me. I'll get him to check
> out
> the replies on the website:
> -------------------
> At the request of a client I have modified the cfwiki code by Ben Raymond.
> The new version no longer looks for two capital letters in a single word
> to
> form a link to a new wiki page. It now allows the user to create new pages
> by wrapping a word, or group of words, in square brackets [my wiki page].
> I
> have the cfc working fine for the page creation piece, but I am running
> across a problem trying to link to a newly created page from text that
> existed prior to the new page creation.  An example of this would be where
> I
> created a new page (let's call it [my page 11]) from page 10 by editing
> page
> 10 and wrapping my page 11 in the square brackets. The link to [my page
> 11]
> shows up on page 10 and works as intended by forwarding me to [my page 11]
> when clicked. The problem comes in on page 9, which may also contain the
> words my page 11 in the page text.
>
> I can't do a simple replacenocase on the substring my page 11 and wrap
> that
> term in square brackets for two reasons: 1. The term my page 11 may
> already
> have the square brackets around it on page 9, in which case I would then
> have double square brackets. 2. An even bigger problem – I may also have a
> page somewhere named [my page 11 definitions]  (or some other name
> containing the new page name within it's string.) In this case I would cut
> off the page link with a replaced string that looked something like [[my
> page 11] definitions].
>
> I know this begs for a rereplacenocase in some form or the other, but it's
> a
> tricky one. I need to replace all LABEL (field name) in the showBlurb
> variable with [LABEL] in all cases where the substring in showBlurb =
> LABEL
> but is not like any other LABEL in the db. The replace only needs to take
> place if there are no other [ open square brackets from the starting
> position of showBlurb to the starting position of the substring, or if a ]
> close square bracket occurs after the [ open square bracket. I just need
> to
> make sure I'm not replacing in the middle of another page name.
>
> I hope this makes sense and is not too confusing. Any help is appreciated.
> -------------------
>
>
> <!----------------//------
> andy matthews
> web developer
> certified advanced coldfusion programmer
> ICGLink, Inc.
> [EMAIL PROTECTED]
> 615.370.1530 x737
> --------------//--------->
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254842
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to