The InStr function searches for a text substring in a given string. Is there an equivalent function that uses a regular expression instead of text as the pattern to look for?
@mapurves123, I close this question as it is the same question as What is the equivalvent of InStr for using regular expressions
Hello @mapurves123
Have a look at REGEX with a replacement string, available since LO 6.2.
To show the community that the question has found its answer, please click on the ✓ aside the top of the correct answer and vote by clicking the ^ caret of all usefull answer.
Please do not use Add Answer but edit your original question to enhance the details of your question (answers are reserved for solutions to a problem on this Q&A site). Thanks in advance …
Kind regards, Michel
f I have this in one of my basic macro Subs:
MyString = “1” MsgBox Regex(MyString, “[0-9]”)
I get this: Error 35: Sub-procedure or function procedure not defined.
This, however, gives me a 0, which it should because it treats my Regex as text.
MyString = “1” MsgBox InStr(MyString, “[0-9]”)