I have an Address: "198 whitten farm Apt 3". I would like to count the number of blank spaces in the address. if it has more than 3 blank spaces I want to eliminate whatever is there after the 3 blank spaces.
Solved
Count the number of blank spaces
Best answer by erik_jan
A StringSearcher transformer with these settings will (in this case) return "198 whitten farm" in the _first_match attribute (you can pick another name or even the address.
The regular expression ^[^\\s]*\\s[^\\s]*\\s[^\\s]* is:
start, then any number of non-space characters, followed by a space, followed by any number of non-space characters, followed by a space ending in any number of non-space characters.
Hope this makes sense.
Reply
Rich Text Editor, editor1
Editor toolbars
Press ALT 0 for help
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.