Brutal 164 Posted November 22, 2014 Report Share Posted November 22, 2014 Hi guys, I'm needing to search a phrase case INsensitive. The user supplies a phrase... it goes into a variable The bot scrapes a google results page, and that goes into a variable. So, of course I tried using the $contains function to see if var1 was found in var2 ... but because of text case issues, it will report as not found when in fact it is there, it is just not in the same case. So, can anyone provide me an example on how to achieve this in a case insensitive way? I assume that this can be achieved using regex, I just don't know how to structure it to work with my variable. Quote Link to post Share on other sites
wheraix00 2 Posted November 22, 2014 Report Share Posted November 22, 2014 case insensitive regex http://stackoverflow.com Quote Link to post Share on other sites
Pete 121 Posted November 22, 2014 Report Share Posted November 22, 2014 Put this at the start of the string (?i) Quote Link to post Share on other sites
Brutal 164 Posted November 22, 2014 Author Report Share Posted November 22, 2014 Thanks Zap ... Can you give me an example?#TheVar (?i) Quote Link to post Share on other sites
UBotDev 276 Posted November 22, 2014 Report Share Posted November 22, 2014 Just add (?i) in the regex, and it will make matching case insensitive.... Quote Link to post Share on other sites
HelloInsomnia 1103 Posted November 22, 2014 Report Share Posted November 22, 2014 I think what he means is instead of doing this: http://rubular.com/r/TiFrDDX9my Do this: http://rubular.com/r/nOc3zspjZT Quote Link to post Share on other sites
Brutal 164 Posted November 22, 2014 Author Report Share Posted November 22, 2014 Thanks guys Quote Link to post Share on other sites
Brutal 164 Posted November 23, 2014 Author Report Share Posted November 23, 2014 Any ideas on how I could achieve case insensitive exact match? Example - Currently, my variable might have the phrase: today is a good day And in the text it's searching, it defines: good day today is a nice phrase ... as a match because it has all of the words. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted November 24, 2014 Report Share Posted November 24, 2014 Any ideas on how I could achieve case insensitive exact match? Example - Currently, my variable might have the phrase: today is a good day And in the text it's searching, it defines: good day today is a nice phrase ... as a match because it has all of the words. Try this: http://rubular.com/r/NuzpXICyVO 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.