SmileyBot 13 Posted September 18, 2016 Report Share Posted September 18, 2016 I want to be able to grab only the first word (any characters)not sure whats going on, but No matter what I try i keep getting the second words after the space, but when i try the code in a regex builders says it works---- please helpset(#business_name,"J1ck$ Bean Stalk","Global")set(#business_name_trimmed,$replace regular expression(#business_name,"^\\s*([a-zA-Z0-9]+)",""),"Global")Result = Bean StalkResult I want = J1ck$Thanks Quote Link to post Share on other sites
pash 504 Posted September 18, 2016 Report Share Posted September 18, 2016 try set(#business_name,"J1ck$ Bean Stalk","Global") set(#business_name_trimmed,$replace regular expression(#business_name,"\\s.*",""),"Global") alert(#business_name_trimmed) Quote Link to post Share on other sites
SmileyBot 13 Posted September 18, 2016 Author Report Share Posted September 18, 2016 thanks mate, it worked..... Do you know why other builders show that it will work... like ( helloinsomnia ) Quote Link to post Share on other sites
HelloInsomnia 1103 Posted September 19, 2016 Report Share Posted September 19, 2016 That works as intended, the reason you are having issues is because you used $replace regular expression and so it replaced the text you told it to. If you wanted to find that text then you would use $find regular expression (which is what the Regex Builder is using that is why you saw that) Hope this clears it up and gets you the intended result. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.