MyEarth 10 Posted November 26, 2015 HelloI need to use RegExp for check if a word match of a list of other words. Example $myvar = Apple, accepted word are Apple, Banana, Mango so match = 1. Accurate, example not accept Apples or Apple ABC, string must be equal but not case sensitive.Thanks for any help Share this post Link to post Share on other sites
mikell 1,007 Posted November 26, 2015 (?i) for case insensitivity\bword\b for word boundariesNo code provided => general response Share this post Link to post Share on other sites
MyEarth 10 Posted November 26, 2015 No code provided? And what kind of code do you need? I have try this way:MsgBox(0,0,StringRegExp("Apple s", "(?i)\b(Apple|Banana|Mango)\b"))Give me 1 so not work Share this post Link to post Share on other sites
mikell 1,007 Posted November 26, 2015 (edited) "Apples" does not match but "Apple s" does (word found)$myvar = "Apple Bananas Mango" $test = StringRegExp($myvar, '(?i)\b(apple|banana|mango)\b', 3) If IsArray($test) Then Msgbox(0,"", UBound($test) & " matches") Edited November 26, 2015 by mikell Share this post Link to post Share on other sites
MyEarth 10 Posted November 26, 2015 (edited) As i have say, the string must be equal but not case-sensitive, no other words in the string. If there are other words need to return 0 also if "partially" match like in the case of "apple s" or "apple abc" Edited November 26, 2015 by MyEarth Share this post Link to post Share on other sites
mikell 1,007 Posted November 26, 2015 (edited) Ah OK, then you need anchors$myvar = "Apple" $test = StringRegExp($myvar, '(?i)^(apple|banana|mango)$') Msgbox(0,"", $test) Edited November 26, 2015 by mikell 1 MyEarth reacted to this Share this post Link to post Share on other sites
MyEarth 10 Posted November 26, 2015 Last seems work as i need. Thanks Share this post Link to post Share on other sites