Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > fr.comp.lang.regexp > #85

Re: Help with RexExp in English?

From Heinz Kesting <Nobody@invalid.invalid>
Newsgroups fr.comp.lang.regexp
Subject Re: Help with RexExp in English?
Date 2017-06-16 00:08 +0200
Organization solani.org
Message-ID <ohv0ho$s3f$1@solani.org> (permalink)
References (1 earlier) <5397fb215ea33b88eb24619edfcc25169f1a0659@news.nemoweb.net> <ohj5ai$ttk$1@solani.org> <ohj7jt$11e9$1@cabale.usenet-fr.net> <ohkc95$n6g$1@solani.org> <ohkgkj$1c5d$1@cabale.usenet-fr.net>

Show all headers | View raw


Hallo Olivier,

Sorry to keep you waiting for so long for my reply, but I really didn't 
find the time to get back to this until now.

> Quel que soit le contexte, un '<a ' (ne pas oublier l'espace) doit
> toujours être suivi d'un '</a>', même si c'est un '<a name=' et pas
> un '<a href='.
> 

I am not sure if I understood what you're trying to point at here, but 
since I am using the 'long' version of your solution, I guess (and hope) 
it doesn't matter here.

> Mais on peut améliorer ce test en prévoyant aussi la fin de fichier :
> '<a ((?!</a>).)*(<a |$)'
> 
> Si vraiment tu tiens à la version longue :
> '<a href=((?!</a>).)*(<a href=|$)'
> 

If I understand correctly what you're doing here, then you make sure 
that we will have a match even if the string "<a href=" is at the very 
end of the text we're testing it on, right?
But that won't be happening - if a hyperlink is inserted, it will always 
be something in the following pattern:

... some other text before a <a href="LINK_KEY_VALUE1">linked text 
passage</a> appears and then any more text ...

where LINK_KEY_VALUE1 would be the value the programme would be looking 
for (and jump to, if found) while the 'linked text passage' would be the 
text in the web interface which would appear underlined to show that 
this is a link to click on. So the text we're testing the RegExp on will 
always end with some normal characters, or if the last word would be a 
hyperlink, it would actually end with </a>, but never with a "<a href="
So, as I understand your change to the RegExp, it would not be necessary 
to test for the possible ending "<a href=".

What I am trying to avoid with this RegExp formula is something like:

<a href="LINK_KEY_VALUE1">linked text <a 
href="LINK_KEY_VALUE2">passage</a></a>

where two consecutive beginning tags of a hyperlink appear before an 
ending tag. This might happen if the user who creates the links 
highlights a text passage which is already part of a hyperlink - in this 
example 'linked text passage' is already linked to 'LINK_KEY_VALUE1', 
and now the word 'passage' is highlighted again and given a link to 
'LINK_KEY_VALUE2', which doesn't make sense.
But since I can not prevent the user from highlighting any text 
passages, I can only test AFTER the link has been created, if the syntax 
of the new link is valid, like the following example:

<a href="LINK_KEY_VALUE1">linked text</a> <a 
href="LINK_KEY_VALUE2">passage</a>

Here the text passage 'linked text' is linked to LINK_KEY_VALUE1 and the 
word 'passage' is linked to LINK_KEY_VALUE2, no consecutive beginning 
tags, but each beginning tag is followed by an ending tag before the 
next begining tag appears.

I hope you can understand what I am meaning ...

Thanks again for your great support!

Kind reagrds, Heinz

Back to fr.comp.lang.regexp | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Help with RexExp in English? Heinz Kesting <Nobody@invalid.invalid> - 2017-06-10 20:57 +0200
  Re: Help with RexExp in English? Duzz' <jsuis@jreste.invalid> - 2017-06-10 20:42 +0000
    Re: Help with RexExp in English? Heinz Kesting <Nobody@invalid.invalid> - 2017-06-11 12:16 +0200
      Re: Help with RexExp in English? Olivier Miakinen <om+news@miakinen.net> - 2017-06-11 12:55 +0200
        Re: Help with RexExp in English? Heinz Kesting <Nobody@invalid.invalid> - 2017-06-11 23:21 +0200
          Re: Help with RexExp in English? Olivier Miakinen <om+news@miakinen.net> - 2017-06-12 00:36 +0200
            Re: Help with RexExp in English? Heinz Kesting <Nobody@invalid.invalid> - 2017-06-16 00:08 +0200
              Re: Help with RexExp in English? Olivier Miakinen <om+news@miakinen.net> - 2017-06-16 01:10 +0200
                Re: Help with RexExp in English? Heinz Kesting <Nobody@invalid.invalid> - 2017-06-18 12:14 +0200
                Re: Help with RexExp in English? Olivier Miakinen <om+news@miakinen.net> - 2017-06-18 19:05 +0200
  Re: Help with RexExp in English? Logan Won-Ki Lee <logan.wonki.lee@gmail.com> - 2021-07-14 12:19 +1000
    Re: Help with RexExp in English? Olivier Miakinen <om+news@miakinen.net> - 2021-07-14 09:23 +0200
      Re: Help with RexExp in English? Otomatic <otomatic@oto.invalid> - 2021-07-14 17:09 +0200

csiph-web