Skip to content

Commit

Permalink
Update replace: make replace('', 'x') works
Browse files Browse the repository at this point in the history
  • Loading branch information
atuonufure committed Dec 4, 2023
1 parent 1577e30 commit d7f02ba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fhirpathpy/engine/invocations/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def matches(ctx, coll, regex):

def replace(ctx, coll, regex, repl):
string = ensure_string_singleton(coll)
if regex == "" and isinstance(repl, str):
return repl + repl.join(character for character in string) + repl
if not string or not regex:
return []
return string.replace(regex, repl)
Expand Down

0 comments on commit d7f02ba

Please sign in to comment.