Validation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Validation

Bharamani
Hi

Is it possible to validate a field using Reg Exp In Orbeon?

for ex. I want to validate a field that should not take 999
for that i will use (?!9{3})([0-9]{3})

but is it possible to use reg exp in orbeon
Thanks
Bharamani
Reply | Threaded
Open this post in threaded view
|

Re: Validation

Alessandro  Vernet
Administrator
Hi Bharamani,

You can use the XPath matches() functions:

matches(., 'your regexp')

Note that the `.` refers the value of the current field.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Validation

Bharamani
Hi

At this point

 matches(., '(?!9{3})([0-9]{3})')

This is not working.

Any other way from your end

Thanks
Thanks
Bharamani
Reply | Threaded
Open this post in threaded view
|

Re: Validation

Alessandro  Vernet
Administrator
Hi Bharamani,

The matches() in XPath doesn't support negative lookahead, per the specification, so you can't use this syntax. But since this is XPath, I think you would gain anyway at writing the expression as:

matches(., '[0-9]{3}') and . != '999'

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet