Commit graph

6 commits

Author SHA1 Message Date
fcaf425042 fix: infinite loop when using .* patterns
Summary:

When we are using `.*` patterns, this causes an infinite loop. What happens is
we are adding text to the end and then replacing that. Its only when we are
matching the end of the output string.

We can detect this when the starting point is the same as the end point and the
match is "" (an empty string). If we hit this condition we can get out and
return the output that has been replaced.

Test Plan:

Test in CI
2024-05-29 17:33:47 +01:00
b098c75cb5 fix: handle invalid regex patterns by returning the input string
Right now we don't want to be panicking if the user provides an invalid regex.
We also don't really want to be throwing or returning an error, this will mess
with any live preview that is going on in external tools.

We should return the input and let any preview display the text. This will
happen if the user is doing some preview as you type kind of thing.
2024-05-11 21:47:21 +01:00
93e64fa8db feat: add input argument to read input from text or stdin
You can now provide input as the content you want to search and replace in. If
you don't provide input, the program will read from stdin.
2024-05-11 21:47:21 +01:00
23868e9df1 feat: add case preserving search and replace 2024-05-11 19:44:05 +01:00
4dc1042c1d test: add regex feature tests 2024-05-11 15:20:03 +01:00
402c67998d chore: initial commit 2024-05-10 20:53:50 +01:00