Forum Discussion

gentlesea's avatar
gentlesea
Frequent Contributor
14 years ago

Regular expressions do not work with aqString.StrMatches in my case, why?


Simple example that does not work as expected:





  var testBoolean = aqString.StrMatches(/TestStringOhneSonderzeichen/, "TestStringOhneSonderzeichen");

  if (testBoolean)

    Log.Message("testBoolean, true");

  else

    Log.Message("testBoolean, false");






EXPECTED: testBoolean, true

OBSERVED: testBoolean, false



More complex example:








  // TODO: find out if it is a splitted logfile (4*"_") or a complete logfile (3*"_")

  var splittedLogFile = aqString.StrMatches(/_[0-9]{1,255}_[0-9]{1,255}\.html/ , logFileToSearchIn);

  if (splittedLogFile)

    Log.Message("splittedLogFile, searchInLatestLogFile will search in all parts.");

  else

    Log.Message("completeLogFile, searchInLatestLogFile will search in this file: " + logFileToSearchIn);





Verifying my expression with the following website states that I do it correctly.



http://regexr.com?30plb



What is going on here?