Jump to content

Recommended Posts

Posted

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))

 

Posted (edited)

Your string it's stored in $short_description_text_1 and your pattern in $string. Of course it cannot find '(po)(?!.*\1\b)' in po. I suppose you want to swap these two.

MsgBox(0,"result: ",StringRegExp($string, $short_description_text_1, $STR_REGEXPMATCH))

 

Edited by Andreik
Posted (edited)
@TheOne23 the superfluous single quote delimiter seems to create the issue :

; Local $string = "'(" & $keywords_split_2 & ")(?!.*\1\b)'"
Local $string = "(" & $keywords_split_2 & ")(?!.*\1\b)"

Does it solve your problem ?
Edited by pixelsearch

"I think you are searching a bug where there is no bug... don't listen to bad advice."

  • 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
  • Recently Browsing   0 members

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