Question

backreference in regexp

  • 25 October 2019
  • 2 replies
  • 3 views

Badge +3

Hi All,

 

Does anyone know this issue?

 

[regexp {^(?!(,)\\1+)(?!(\\d)\\2+)[0-9,]+$} {@Value(_attr_value)}]

and with a simpler regexp

(?!(,)\\1+)[0-9,]

 

As you can see it uses back references. ( the \\1 and \\2)

Both raise an error when used in a attribute creator. Error says "invalid back reference" number is used. Which is not true.

I suspect that the negative back reference handling causes this?

 

But..

The same regexp works if I use a string searcher. It does what I intended (and matches Rubular behavior) and does not complain about faulty back reference numbers.

 

Is the [regexp .. .. ] flawed?

 

 

 


2 replies

Userlevel 1
Badge +21

I know at one time regex was implemented slightly differently depending on where it was being used. But I thought it had all been standardised now

Badge +3

@ebygomm

Did you try creating a scripted parameter where u would like to output a string with a space (or more spaces)?

 

In tcl scripted parameter this fails all over..until you decide to not use a space character or shorthand for space (\\s). Only works when u use the Unicode \\U040.

 

Though much improved, there seem to still be remnants of days past.

 

So in parameter, in tcl regexp, regexp in stringsearcher ...all differ somewhere still.

But again, used to be much worse..:)

 

 

Reply