String reg exp error on launching in line 1

Asked By 10 points N/A Posted on -
qa-featured

Hi,

Get File name from $CmdLineRaw without path and this error appeared. I got this example from a tutorial and I followed all the steps from the tutorial and only on my PC this error appeared. I am a newbie and I want to learn but I for now I cannot solve this kind of errors. Any expert can help me please to fix this one ?

Thank you experts !

test

Error in StringRegEXP () ‘The Error Number is : 1’

SHARE
Answered By 590495 points N/A #179622

String reg exp error on launching in line 1

qa-featured

Problem here is that you did not say what programming language is it you are using in constructing the program codes you are testing. If you only found the program code in a website as a sample then it is possible that the code given contains errors. Sample source code usually has errors in it since it is only meant for reference to coders.

So, in your case, since I think you only copied and pasted the program source code, expect it to have errors and it is up to you to fix it. The only problem is you don’t know how to fix it since you are only learning about. I guess the issue with your sample code directly points to the command “StringRegExp()”.

If you are just a beginner, “StringRegExp()” is a function used in AutoIt scripting tool. The correct syntax for this function is:

  • StringRegExp( "test" , "pattern" [, flag ] )

“test” refers to the string to search for matches. “pattern” is a string composed of specific key characters that tells the function exactly what you want to match. Flag or flag is optional as indicated by the open and close square brackets. When a string is enclosed in square brackets, it means it is optional or it is up to you if you want to add it or not.

Flag tells the function if you simply want to identify if the “pattern” is found or if you want the first match to be returned. You can also set flag to return all the matches. See the samples below.

  • MsgBox(0, "SRE Example 1 Result", StringRegExp("text", 'test'))
  • MsgBox(0, "SRE Example 3 Result", StringRegExp("text", 't{1}e{1}[sx]{1}t{1}'))

Related Questions