LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

regex (backreference)

hello,

 

How to have the "opposite" of a reference ?

 

(sorry for my bad english, i do my best)

 

(3)[^3] matches "32", "3a" ...

 

I would like to replace the second term < [^3] > by a reference to the first term < (3) >   ....   ...\1 instead of [^3]

 

The problem is the " ^ " ... and obviously, (3)[^\1] does not work !

 

in other words, all except  " \1 "

 

is there a way to do that ?

 

Thanks to all,

 

0 Kudos
Message 1 of 7
(3,662 Views)

show us an example input string....and what results you want from it?

 

Also, look at "regular expressions board"

0 Kudos
Message 2 of 7
(3,654 Views)

thank you Apok,

 

but i don't need a particular/specific résult from a input string ...
it's not the purpose of my question.


i'm learning the regular expressions, and i just asked myself this question


is it possible to have the opposite of a reference ?
all exept this reference ... is there a way with PCRE to do that ?

0 Kudos
Message 3 of 7
(3,631 Views)

@ouadji wrote:

hello,

 

How to have the "opposite" of a reference ?

 

(sorry for my bad english, i do my best)

 

(3)[^3] matches "32", "3a" ...

 

I would like to replace the second term < [^3] > by a reference to the first term < (3) >   ....   ...\1 instead of [^3]

 

The problem is the " ^ " ... and obviously, (3)[^\1] does not work !

 

in other words, all except  " \1 "

 

is there a way to do that ?

 

Thanks to all,

 


(3)[^\1] seems to work if you use Match Regular Expression and not Search and replace.

See attached.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 7
(3,594 Views)

Yes, i use "Match regular expression" (and not Search and Replace)

 

but (.)[^\1] in your attached Vi does not work (with LV 2013)

 

with an input string "3313" , (.)[^\1matches "33" .. this is not the good résult ...

 

it should match "31" ( 3 and all exept 3 )

 

it works for you with LV2011 ???

0 Kudos
Message 5 of 7
(3,579 Views)

You're right, it only matches the 2 first chars regardless!

If you change it to "(.)[\1]" it should get the first instance of double characters, which it also doesn't.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(3,562 Views)

Hello Ouadji,

 

While checking out this question I saw that it might be linked to a question in the BreakPoint section.

I'm just going to refer to it from over here to close the loop:
http://forums.ni.com/t5/BreakPoint/Regular-Expressions-Board/td-p/1187799/page/13

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 7 of 7
(3,509 Views)