CLI - Regex with "?"

cancel
Showing results for 
Search instead for 
Did you mean: 

CLI - Regex with "?"

L1 Bithead

Hello all,

 

Does anybody know how to use a Regex that contains "?", obviously that doesn't work because that automatically triggers the helper?

For example, I'm trying to filter results for a certain CLI command using this:

 

| match (?s)(word1.*?)(?=word2|$)

 

You can see that it contains multiple question marks, I'm not sure what I can do to get those through (if at all possible) and Palo documentation doesn't help.

2 REPLIES 2

Cyber Elite
Cyber Elite
The regular expression syntax in PAN-OS® is similar to traditional regular expression engines but every engine is unique. The following table describes the syntax supported in PAN-OS.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Pattern Rules Syntax
Description
.
Match any single character.
?
Match the preceding character or expression 0 or 1 time. You must include the general expression inside parentheses.
Example: (abc)?

 

I see that you are not putting the parenthesis around correctly perhaps.. word1.*?  should be (word1.*)?   According the to docs.

 

 

Help the community: Like helpful comments and mark solutions

Thanks, I did indeed try the suggested parenthesis thing before from the documentation but that didn't help, the "?" was still getting omitted.

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!