Jump to content

StringRegEx not working when inserting a variable in the pattern


Recommended Posts

Hi Guys,

Can you help  me figure out why my test script is not working? it is showing "0" which is not match where I tried to put same value of string already.

It worked when it is not in a variable format.

Example:

This works - StringRegExp($short_description_text_1,'(po)(?!.*\1\b)',$STR_REGEXPMATCH)

This does not work - StringRegExp($short_description_text_1,$string,$STR_REGEXPMATCH)

 

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>

local $short_description_text_1 = "po"
local $keywords_split_2 = "po"
local $string = "'("& $keywords_split_2 &")(?!.*\1\b)'"
;~ MsgBox(0,"",$string)
;~ MsgBox(0,"result: ",StringRegExp($short_description_text_1, "'(" & $keywords_split_2 & ")(?!.*\1\b)'" ,$STR_REGEXPMATCH))
MsgBox(0,"result: ",StringRegExp($short_description_text_1,$string,$STR_REGEXPMATCH))

 

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...