Palo Alto Search Filtering in Contains

Showing results for 
Show  only  | Search instead for 
Did you mean: 
Please sign in to see details of an important advisory in our Customer Advisories area.

Palo Alto Search Filtering in Contains

L0 Member



I write a basic python code for 'contains' filtering in in rule name search. And I want to share with community also community can give an advice for me.


The code: 


def generate_output(numbers) :
    output_strings = []

    for number in numbers:
        output_strings.append("(name contains 'Rule " + str(number) + "') or ")

    # Remove the trailing "or" from the last string
    output_strings[-1] = output_strings[-1][:-4]

    return output_strings

# Get input from the user
user_input = input("Enter a list of numbers without spaces, separated by commas: ")
input_numbers = [int(num) for num in user_input.split(',')]

# Generate output strings
output_strings = generate_output(input_numbers)

# Combine strings with "or" and display side by side
combined_output = " ".join(output_strings)

Output: tombombadil_0-1706780527481.png

Community Team Member

Hi @tombombadil ,


Thanks for your contribution !

I'm sure users can use this and other script gurus can add to it !


Kind regards,


LIVEcommunity team member, CISSP
Please help out other users and “Accept as Solution” if a post helps solve your problem !

Read more about how and why to accept solutions.
  • 1 replies
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!