summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2026-03-09 12:54:53 -0400
committerBrian Potchik <brian@vector35.com>2026-03-09 12:54:53 -0400
commitb8fdf800de345f93b2e68713d14bac425a62feb3 (patch)
tree8c75358eb2e0115017a3bbb13865b007508eb266 /python
parent695a94cdd9bd5e886ee82da60ebc5ffca5972fcb (diff)
Expose BNDetectSearchMode to Python API for search mode testing.
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 884745a6..4e62af61 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -9911,6 +9911,20 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
t = threading.Thread(target=lambda: core.BNSearch(self.handle, json.dumps(query), None, progress_callback_obj, None, match_callback_obj))
return self.QueueGenerator(t, results)
+ @staticmethod
+ def detect_search_mode(pattern: str, raw: bool = False) -> str:
+ """
+ Detects the search mode that would be used by :py:meth:`search` for the given pattern.
+
+ :param str pattern: The search pattern to analyze.
+ :param bool raw: Whether to interpret the pattern as a raw string (default: False).
+ :return: The detected search mode: ``"FlexHex"``, ``"Regex"``, or ``"Raw String"``.
+ :rtype: str
+ """
+ query = json.dumps({"pattern": pattern, "raw": raw})
+ result = core.BNDetectSearchMode(query)
+ return result
+
def reanalyze(self) -> None:
"""
``reanalyze`` causes all functions to be reanalyzed. This function does not wait for the analysis to finish.