Orbeon Regex

8 views
Skip to first unread message

Oscar

unread,
Jan 29, 2020, 2:12:49 PM1/29/20
to Orbeon Forms
All,

I have a field that is being automatically populated that holds the user account. However, the information being sent from the source has the full username in the format: 123...@domain.net as opposed to just the 1234567. 

Would there be a way to leverage regex against the field to truncate the username to only extract the username and drop the @domain.net?

Regards, 

Oscar

Jarosław Kowalewski

unread,
Jan 29, 2020, 2:52:41 PM1/29/20
to orb...@googlegroups.com
Hi,
maybe will be enough to use XPath function substring-before(' 123...@domain.net','@')
Nice list of available functions with examples you can find https://www.w3schools.com/xml/xsl_functions.asp

//Jarek
fn:substring-before(string1,string2)Returns the start of string1 before string2 occurs in it

Example: substring-before('12/10','/')
Result: '12'


--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/9ad03a7a-5359-4735-aeb8-65a3b3ebce8b%40googlegroups.com.

Oscar

unread,
Jan 29, 2020, 3:09:04 PM1/29/20
to Orbeon Forms
Thank you. I will give this a try

Oscar

unread,
Jan 29, 2020, 4:16:02 PM1/29/20
to Orbeon Forms
Thanks Jerek. This worked. 

I have setup a hidden field to be the landing spot for the data. Then, I have used the function substring-before($control,'@') in the initial value. 

according to the Orbeon documentation, there is no need to prefix these functions. 

Regards, 

Oscar

Jarosław Kowalewski

unread,
Jan 29, 2020, 4:28:24 PM1/29/20
to orb...@googlegroups.com
Great,
and you don't need to add hidden fields. 
In the initial value combine two functions substring-before(xxf:get-request-header('username'),'@')

//Jarek

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages