willut72 0 Posted October 4, 2013 Report Share Posted October 4, 2013 I am pulling in a string from a table and attempting to look at a text string to identify if it starts with an alphabetic character (i.e. A-Z), and if it does I want to insert a space (i.e. " "). I was attempting to do this with a regular expression, but I must be missing something, below is a snippet of the code I am using. I think I must be missing something in how I am attempting to identify the alphabetic characters. Any help would be greatly appreciated. set(#SomeTextString, $table cell(&SomeTable, #SpecificRecord, 4), "Global") set(#1stLetterSomeTextString, $substring(#SomeTextString, 0, 1), "Global") if($find regular expression(#1stLetterSomeTextString, "[A-Z]")) { then { set(#SomeTextString, $insert text(#SomeTextString, " ", 0), "Global") } else { set(#SomeTextString, $table cell(&SomeTable, #SpecificRecord, 4), "Global") } } Quote Link to post Share on other sites
UBotDev 276 Posted October 4, 2013 Report Share Posted October 4, 2013 You can't just use "find regular expression" inside if condition...if text that regex returns is different than "True", bot will always go into else statement (this is what happens in your case, that's why insertion doesn't work). This is how you do it properly: set(#SomeTextString, "Test", "Global") set(#stLetterSomeTextString, $substring(#SomeTextString, 0, 1), "Global") if($comparison($text length($find regular expression(#stLetterSomeTextString, "[A-Z]")), ">", 0)) { then { set(#SomeTextString, $insert text(#SomeTextString, " ", 0), "Global") } else { } } Quote Link to post Share on other sites
willut72 0 Posted October 4, 2013 Author Report Share Posted October 4, 2013 That worked thanks! 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.