extractx problem
no experience with regex
Need to use extractx
If anyone can help, would be greatly appreciated!
text field = textA - textB
would like to put textA into one field and textB into another field (functionfields):
textfield1 = textA
textfield2 = textB
7 replies
-
Hi Louis,
I'm not sure if your text field is something like "wordA - wordB" or "any text with as many spaces as you like - and another text with 4 or more word separated by the minus sign".
In case of "wordA - wordB", the command you're looking for is:
textfield1 := extractx('Gerätename', "^\b[A-Za-z]*\b") textfield2 := extractx('Gerätename', "\b[A-Za-z]*\b$")
-
"
"^\b[A-Za-z]*\b" fascinating. Need to learn this, remarkable terse. Thank you but the problem is "text variable length1" space-hyphen-space "text variable length2"
-
I feared so ... here's the trick. Just add a " " to the allowed characters
let mytext := "whatever you want - whatever you like"; let textfield1 := extractx(mytext, "^\b[A-Za-z ]*\b"); let textfield2 := extractx(mytext, "\b[A-Za-z ]*\b$") textfield1 + " / " + textfield2
AND ... if you like to have numbers in the "text variable length1":
let mytext := "whatever you want - whatever you like"; let textfield1 := extractx(mytext, "^\b[A-Za-z0-9 ]*\b"); let textfield2 := extractx(mytext, "\b[A-Za-z0-9 ]*\b$") textfield1 + " / " + textfield2
And btw, 'Gerätename' was just a field name I had in a test database and which I used ... forget it.
It you want to know what the stuff means:
- ^ is the beginning of a text, i.e. for textfield1 I start the search at the beginning
- [A-Za-z0-9 ] searches for a character from exactly that range
- * means 0 or more of these characters
- \b looks for a word boundary, i.e. any non-character, which in your case means the "-"
- and $ is the end of the string, i.e. textfield2 searches for such a string that ends at the end of the string.
-
Thanks Lars. Will try this now.
-
Thank you. Much appreciated.
Content aside
- Status Answered
- 2 yrs agoLast active
- 7Replies
- 79Views
-
2
Following