Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions Packs/CommunityCommonScripts/ReleaseNotes/1_5_0.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@

#### Scripts

##### New: isStringInList
##### New: IsStringInList

# Release Notes: `isStringInList`
## Description
Checks whether a specified string exists within a named list in Cortex XSOAR. Returns `"yes"` if found, `"no"` otherwise. Supports optional wildcard and case-insensitive matching.
## Use Cases
- Validate if a user, domain, or indicator is part of a predefined list.
- Control playbook flow based on list membership.
- Support allow/block decisions using list-based logic.
- Match values using wildcards or case-insensitive comparison.
## Inputs
- `searchString` (string): The value to search for.
- `listName` (string): The name of the list to search in.
- `caseInsensitive` (string, optional): Set to `"true"` to ignore case when matching. Default is `"false"`.
- `useWildcard` (string, optional): Set to `"true"` to enable `*` and `?` wildcard matching. Default is `"false"`.
## Outputs
- `"yes"` if the string is found in the list.
- `"no"` if the string is not found or the list is empty.
## Limitations
- Wildcard matching uses basic patterns: `*` for any sequence, `?` for a single character.
- Case-insensitive and wildcard logic do not support partial substring matching.
inputArray: the context array/list data
listName: the XSOAR system list.
# Release Notes: `IsStringInList`

A new script that checks whether a specified string exists in a named list in Cortex XSOAR.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import re

# Get arguments
search_string = demisto.args().get("searchString")
list_name = demisto.args().get("listName")
case_insensitive = demisto.args().get("caseInsensitive", "false").lower() == "true"
use_wildcard = demisto.args().get("useWildcard", "false").lower() == "true"
search_String = demisto.args().get("searchString")
list_Name = demisto.args().get("listName")
case_Insensitive = demisto.args().get("caseInsensitive", "false").lower() == "true"
use_Wildcard = demisto.args().get("useWildcard", "false").lower() == "true"

# Retrieve the list content
res = demisto.executeCommand("getList", {"listName": list_name})[0]
res = demisto.executeCommand("getList", {"listName": list_Name})[0]
list_contents = res.get("Contents", "")

# Normalize list to lines
Expand All @@ -19,18 +19,18 @@
list_items = list_contents

# Prepare search pattern
if search_string and list_items:
if use_wildcard:
if search_String and list_items:
if use_Wildcard:
# Convert wildcard to regex: * → .*, ? → .
pattern = re.escape(search_string).replace(r'\*', '.*').replace(r'\?', '.')
flags = re.IGNORECASE if case_insensitive else 0
pattern = re.escape(search_String).replace(r'\*', '.*').replace(r'\?', '.')
flags = re.IGNORECASE if case_Insensitive else 0
regex = re.compile(f"^{pattern}$", flags)
match_found = any(regex.match(item) for item in list_items)
else:
if case_insensitive:
match_found = any(search_string.lower() == item.lower() for item in list_items)
if case_Insensitive:
match_found = any(search_String.lower() == item.lower() for item in list_items)
else:
match_found = search_string in list_items
match_found = search_String in list_items

demisto.results("yes" if match_found else "no")
else:
Expand Down