Regular expressions are a means of matching a pattern of characters within a string.

learn more… | top users | synonyms (1)

7
votes
1answer
368 views

Why do some regex commands have opposite intepretations of '\' with various characters?

Take, for example, this command: find . -regex ".*\.\(cpp\|h\)" This will find all the .h and .cpp files in your directory. The period character '.' in regular expressions usually means "any ...
14
votes
10answers
3k views

There must be a better way to replace single newlines only?

I am in the habit of writing one line per sentence because I typically compile things to LaTex, or am writing in some other format where line breaks get ignored. I use a blank line to indicate the ...
1
vote
4answers
2k views

Processing control characters

I have a log file which contains a bunch of non visible control characters such as hex \u0003. I would like to replace this using something like SED, but can't get the first part of the regex to ...
3
votes
1answer
284 views

Ex and Vi: buffers and regexes

I want to put regex matches to buffer but cannot get even simpler example y :.put myNewBuffer return msg [line] [put] [buffer] working ie how to put something to buffer? So to regular expressions ...
2
votes
2answers
391 views

lookbehind and using it with grep in Vi?

Trying to get into Vi (not Vim), after learning Vim. Vim has a lookabehind like /\(Not this\)\@<!$, how to do it in Vi? If I want to search recurvively down directory in Vim, I could do :vimgrep ...
4
votes
2answers
404 views

How to find files with names having a long string after the first dot

My Samsung Galaxy S doesn't like files where the name contains a long string after the first dot. I guess some part of the software has a too short buffer for the file extension. How can I find all ...
3
votes
4answers
2k views

Applying a regex to stdin

In programing we often see the use of Regular Expressions. One of the most common forms is: newText = text.replace( /regex/, 'replacementString' ) If stdin is text and stdout is newText, what ...
37
votes
2answers
32k views

Find files with certain extensions

How can I use find to find all files that have a .xls or .csv extension? I have seen a -regex option but I don't know how to use it.