Hello,
I have string like this
xxs_s90_w9wun_5 dds-O4s-sssc-IC
And I need to get substring (preferably used regex) between 2nd _ and 3rd _. In my example it is w9wun
.
Thank you for help
Just Split it on _ and then take the third item from the array (index 2).
Split("xxs_s90_w9wun_5 dds-04s-sssc-IC","_")(2)
A regex could look like this (we keep in mind that regex is left to right anchored for the base point)
But we keep in mind that with other options (e.g. split) it can be achieved within a more essential style
Input = "xxs_s90_w9wun_5 dds-O4s-sssc-IC"
Output = System.Text.RegularExpressions.Regex.Match(Input,"(?<=\w+\d+_).*(?=_)").Value.Trim()
Regards
Hi,
FYI, another approach
System.Text.RegularExpressions.Regex.Matches(yourString,"[^_]+")(2).Value
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.