AndyJarrett

RegEx word boundaries

Recently I was looking for the word "fail" or "pass" in a string so I had the following regEx set up:#reFindNoCase("pass|fail", status)#Which worked fine until testing came along and "failed" got passed through successfully. To prevent this you need to use regex boundaries, "\\b", so my new statement becomes:#reFindNoCase("\\bpass\\b|\\bfail\\b", status)#In simple terms "\\b" perform a "whole word only" search means that it trapped 'failed', 'failure' you get the point.