I don't remember what it did, but I tried -n, and it gave a worse
result.
Well, in this case, the suggestions given by Magic Banana work well
together with mine. ;)
The extra line that you said gets inserted is because you forgot `-n',
if you absolutely don't want `-n', then remove the `p' flag from the `s'
command.
2017-11-27T18:18:36-0600 Caleb Herbert wrote:
> Your
> If you instead want "^" to be considered as special in "^x ", this:
>
> --8<---cut here---start->8---
> sed -n 's/^x .*\(.\)$/\1/gp' "file.txt"
> --8<---cut here---end--->8---
Your suggestion does not add to the lines.
In the last paragraph, by "line terminator", I meant either:
- line feed only (LF, 0x0A, "\n"). Default for Unix-compliant operating
systems such as GNU;
- carriage return only (CR, 0x0D, "\r"). Default for Mac;
- carriage return and line feed (CRLF, 0x0D, "\r\n"). Default for
Windows.
I assume that by "the end" of the line you want to actually capture the
last character, which ever it is.
Suppose you have a text file like this (the underlines are *also*
spaces, please correct them):
--8<---cut here---start->8---
c ^x a1
y b2
z c3
b x d4
y
The '$' (end) of any line that matches '^x '.
Unfortunatelly no, but you can test with various dummy files/texts.
I wonder however, what exactly you want the regular expression to match,
or not to match, and which programming language is it?
2017-11-27T11:56:02-0600 Caleb Herbert wrote:
> Does it have a regex key on the side or elsewhere?
>
Does it have a regex key on the side or elsewhere?
That was exactly my suggestion, with the advantage that you don't need
internet. ;)
2017-11-27T10:59:53-0600 Caleb Herbert wrote:
> I'm using Regexr because I want something like Daring Fireball's
> Markdown Web Dingus, but for regular expressions.
>
>
I'm using Regexr because I want something like Daring Fireball's
Markdown Web Dingus, but for regular expressions.
https://daringfireball.net/projects/markdown/dingus
I don't understand how interactive it's supposed to be?
Do you mean that it should ask you everytime "do you want to match
file?".
I don't which RegEx engine you want to use, nor the programming
language, but at least in GNU `find', one can use something like:
find "." -regex '.*\.png$' -print
If I were going that route, I'd be using regex-builder in Emacs, but
sometimes even it isn't interactive enough.
1. Make a test folder/directory with various dummy files that would be
similar to the RegEx (if you are making directory/path expansion
tests). Or a test file with contents inside (if you are testing for
file's contents).
2. Make the RegEx software attempt the wanted RegEx against that
I'm having issues running Regexr in Abrowser.
http://bluehome.net/csh/screenshot/2017/11/24/regexr
What could be going wrong?
Regexr is a free software web app for interactively exploring regular
expressions.
--
Caleb Herbert
OpenPGP public key: http://bluehome.net/csh/pubkey
signature.asc
14 matches
Mail list logo