Highlighted
Absent Member.
Absent Member.
1922 views

about SiteScope URL Monitor setting of Match content and Match content for error

Hi, I am using SiteScope,

 

When I had a URL 'http://test.example.com/test.cgi' to be monitored,

 

and setting as the following

 

Match content: /<tag>blah blah</tag>/

Match content for error: /<tag>error here</tag>/

 

should I have to use a backward slash '\' to escape the forward slash of </tag>

or the regex won't work as expected?

 

btw, by testing tool to test the following pattern

 

pattern 1: /<tag>blah blah</tag>/

pattern 2: /<tag>blah blah<\/tag>/

 

they all match the string '<tag>blah blah</tag>',

 

I am confused here.

Does anyone know the reason?

 

Thanks for the answer.

 

 

Labels (2)
Tags (1)
0 Likes
7 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..


should I have to use a backward slash '\' to escape the forward slash of </tag>

or the regex won't work as expected?

 


Yes you should.

 



pattern 1: /<tag>blah blah</tag>/

pattern 2: /<tag>blah blah<\/tag>/

 

they all match the string '<tag>blah blah</tag>',

 

I am confused here.

Does anyone know the reason?

 

 


First pattern is like deifinig '/<tag>blah blah</' so it matches your string as well as other (example <tag>blah blah<ANYTEXTHERE).
 
Have a nice day,
                        Paolo
0 Likes
Highlighted
Absent Member.
Absent Member.

 

Hi Paolo,

 

 

Thanks in advance!!! Your answer is very useful for me.

 

so in SiteScope,

the pattern 1

 

/<tag>blah blah</tag>/

 

won't be treat as a wrong regex pattern

but just look it as /<tag>blah blah</

 

no wonder I got the confused result...

 

but the testing tool told me that (with pattern 1)

matched the string <tag>blah blah</tag>

start position 0

end position 20

as full string <tag>blah blah</tag>

 

and I test it online again

here http://193.138.212.37/SiteScope/cgi/go.exe/SiteScope

 

Text will be matched: <tag>blah blah</xxx>

Regular Expression: /<tag>blah blah</tag>/

 

Result:

Content Match Results Content match error  

 

(not as your explaination - to match as <tag>blah blah<ANYTEXTHERE)

 

and

 

Text will be matched: <tag>blah blah</tag>

Regular Expression: /<tag>blah blah</tag>/

or

Regular Expression: /<tag>blah blah<\/tag>/

 

got the same matched  result, except the 'Your Regular Expression:' is different depends on the given regular expression

 

Content Match Results

Your Regular Expression: /<tag>blah blah</tag>/


Parsed parentheses and matches: Parentheses counted from left matching text

 

Whole Match Between Slashes: <tag>blah blah</tag>



Highlighted match in blue:

Go to the matching text

Starting Position: 0
Ending Postion: 20

<tag>blah blah</tag>

 

 

 

 

 

 

 

 

0 Likes
Highlighted
Absent Member.
Absent Member.

 

and I test another case again.

 

Text to be matched: <tag>blah blah</tag>

Regular Expression: /<tag>blah blah</tags>/

 

Result: Content match error

 

so, </tags> in pattern /<tag>blah blah</tags>/ still be taken into consideration,

not just test by /<tag>blah blah</ only

 

very confused...

 

0 Likes
Highlighted
Established Member..
Established Member..

If you are interested only on "blah blah blah" then use parenthesis:

 

 /<tag>(blah blah)<\/tag>/

 

This will match evertyhting but for evaluation in content match in htresholds only match within parentesis will be included.

 

 

 

Kenneth Gonzalez
HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.

If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums
0 Likes
Highlighted
Absent Member.
Absent Member.

Hi Kenneth,

 

Thanks for the help.

 

Unfortunately, in our case, the <tag> & </tag> must be included.

 

I just want to make sure why the regex of SiteScope handle about

the forward slash '/' in the pattern is different from standard regex,

it seems that with or without escaping by backward slash '\' before

the character '/' in the pattern, the matched results are all the same.

 

Meanwhile, the user guide also said that we must use backward slash

to escape the forward slash in the pattern.

 

I asked this question to a 3rd party support who sale the HP

product to  us, he said this is a fault-tolerance feature.

 

Does it mean that the regex of SiteScope automatically escape the

forward slash in the pattern, and we don't need to worry about it

when we forgot to type the escape character '\'?

 

Thanks for the answer.

 

 

 

 

0 Likes
Highlighted
Established Member..
Established Member..

OK, so to inclue "<tag>" just not use the parenthesis:

 

/<tag>blah blah<\/tag>/

 

or surround everyting in parethensis, is equivalent:

 

/(<tag>blah blah<\/tag>)/

 

SiS regex engine is basic POSIX (not extended), with difference that we need to escape the slash because it is used to delimit regex pattern.

Kenneth Gonzalez
HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.

If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums
0 Likes
Highlighted
Absent Member.
Absent Member.

 

> SiS regex engine is basic POSIX (not extended), with difference that we need to escape the slash because it is used to delimit regex pattern.

 

Yes, I suppose that  most programmer who ever used regex all know about the purpose of this escape slash '\'

 

I just want to make sure why in SiteScope

 

/<tag>...</tag>/ won't get error warning while other regex engine won't accept such a pattern

 

is it a bug?

or just really a feature when user forget to add a '\' before '/' and SiteScope will still work as what user expected

 

btw, I am not talking about the first '/' and the last '/', just the '/' in '</tag>'.

 

 

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.