0
index with regex
I'm trying to find a way to get the index (i.e. start position in a string) for a regex pattern. I can use text, replacex, extractx for various operations but not for getting the index, and the index function does no allow regex patterns.
5 replies
-
You can use the extractx function in the index function. You can see an example of this here...
https://forum.ninox.com/t/35hrtfc/extractx-g-flag-workaround
-
You can do this in two stages:
extract text using a regular expression
find the position of the result text using the index function :
var myText := "ABC123"; var myRegExp := "\d+"; var textResult := extractx(myText, myRegExp); var position := index(myText, textResult); myText + " | " + textResult + " | "+ position;
return : ABC123 | 123 | 3
-
Or maybe:
length(replacex(<your input string>, "<your regular expression>[^]*", ""))
-
Ah, smart, thanks! I did something similar, but way less efficient
Content aside
- Status Answered
- 10 mths agoLast active
- 5Replies
- 109Views
-
4
Following