Hello,
I have multiple large strings that have in common a string that I need to extract and starts with “HTEL”.
So for example :
Case 1: String is : " My desired phone model is HTEL2203 and is out now. → I need to extract “HTEL2203”
Case 2: String is : " 123 HTEL445new" → I need to extract HTEL445new
Thanks in advance !
ppr
(Peter Preuss)
March 27, 2024, 1:54pm
2
Regex could be one of more options:
This CheatSheet introduces the basic use of regex functions. With further examples also special cases are presented.
Introduction
From the namespace System.Text.RegularExpressions following methods are offered:
Regex.Match
Regex.Matches
Regex.isMatch
Regex.Replace
Regex.Split
A simple usage for example would look like this:
[grafik]
Recommendation:
add System.Text.RegularExpressions to the imports:
[grafik]
it allows to use the shortened statement, as the namespace part can be ommited…
Assign Activity:
strExtract =
System.Text.RegularExpressions.Regex.Match(yourText, "HTEL.*?\b").Value
It’s working perfectly but I forgot to add some details, actually I need to extract from the string all that starts with BE**HTEL where the * are dynamic numbers.
So I can have BE02HTEL, BE56HTEL and so on. Is there any way to achieve that with REGEX ?
It’s working!Thank you so much!
system
(system)
Closed
March 31, 2024, 3:55pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.