question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sed doesn't replace combination of name+parens+semicolon

See original GitHub issue

Node version (or tell us if you’re using electron or some other framework):

v13.12.0

ShellJS version (the most recent version/Github branch you see the bug on):

v0.8.4

Operating system:

macOS 10.15.4 (19E287)

Description of the bug:

When running sed("-i", "someString();", "anything", "anyfile"), sed will not replace.

Is this intended behavior? Do I have to escape something? In JS replace this should work …

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nfischercommented, Apr 28, 2020

Right, unix sed defaults to unextended regex but shell.sed() defaults to something like extended regex (really, it’s whatever syntax the JavaScript RegExp constructor accepts). I filed #996 to track possibly changing the behavior in the future.

0reactions
ulococommented, Apr 28, 2020

Thanks. Great work btw 😃))

Read more comments on GitHub >

github_iconTop Results From Across the Web

bash - sed doesn't replace all semicolons - Stack Overflow
Your original command with 's/\;/";"/' will only make one replacement, the first. Share.
Read more >
Sed should be compatible with non-extended regex by default
See issue #995 shell.sed() can accept either a JavaScript RegExp object or ... sed doesn't replace combination of name+parens+semicolon #995.
Read more >
Linux sed command help and examples - Computer Hope
Sed programs​​ Commands within a script or script-file can be separated by semicolons (";") or newlines (ASCII code 10). Some commands, due to ......
Read more >
replace first semicolon occurence - sed - Unix Stack Exchange
With regular expression how can select the first occurrence and replace for ";" I have the next command in sed: sed -i 's/;;/;/g'....
Read more >
Sed - An Introduction and Tutorial - The Grymoire!
I've heard that combining the number with the g command does not work on The MacOS, and perhaps the FreeSBD version of sed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found