diff --git a/Packs/CommunityCommonScripts/ReleaseNotes/1_5_0.md b/Packs/CommunityCommonScripts/ReleaseNotes/1_5_0.md index f12ab9f86a41..49cf1b4ff5ce 100644 --- a/Packs/CommunityCommonScripts/ReleaseNotes/1_5_0.md +++ b/Packs/CommunityCommonScripts/ReleaseNotes/1_5_0.md @@ -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. \ No newline at end of file diff --git a/Packs/CommunityCommonScripts/Scripts/IsStringInList/IsStringInList.py b/Packs/CommunityCommonScripts/Scripts/IsStringInList/IsStringInList.py index 9d4081daac37..7d3f34c93314 100644 --- a/Packs/CommunityCommonScripts/Scripts/IsStringInList/IsStringInList.py +++ b/Packs/CommunityCommonScripts/Scripts/IsStringInList/IsStringInList.py @@ -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 @@ -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: