MCPcopy Index your code
hub / github.com/clips/pattern / escape

Function escape

pattern/text/search.py:897–903  ·  view source on GitHub ↗

Returns the string with control characters for Pattern syntax escaped. For example: "hello!" => "hello\!".

(string)

Source from the content-addressed store, hash-verified

895 return compile(pattern, *args, **kwargs).search(sentence)
896
897def escape(string):
898 """ Returns the string with control characters for Pattern syntax escaped.
899 For example: "hello!" => "hello\!".
900 """
901 for ch in ("{","}","[","]","(",")","_","|","!","*","+","^"):
902 string = string.replace(ch, "\\"+ch)
903 return string
904
905#--- PATTERN MATCH ---------------------------------------------------------------------------------
906

Callers 2

stringMethod · 0.70
cmpFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…