Would I use regex for this?
Extract all words from string that are in CAPITAL but word length must be at least 3 characters?
Would I use regex for this?
Extract all words from string that are in CAPITAL but word length must be at least 3 characters?
Use System.Text.RegularExpressions.Regex.Matches(MyStr, "[A-Z]{3}")
, where MyStr
is the string on which you’re searching.
hey its splitting up words like UNITED STATES to UNI TED STA TES
Use System.Text.RegularExpressions.Regex.Matches(MyStr, "([^\w]|^)[A-Z]{3}(?!\w)").Trim
instead.
how do i do this in the matches activity? I get an error when I try and assign it
This returns a MatchCollection. You need to use a For Each loop to iterate over each of the matches.
hey so it won’t let me put the Trim in there. When i took the trim out, it only brought me words with 3 characters like CAD. I want 3 characters or more.
Ha this one is tricky
Ah, my mistake. Remove the .Trim part, and use that on each of your matches instead.
But how do I make it show words that are 3 letters or greater? With what you gave me it will give me words like LKR, CAD, USD, but not UNITED STATES
Change the regular expression to [A-Z]{3}\w*
.
Beauty thanks!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.