Regular expressions: Difference between revisions

From Cor ad Cor
Jump to navigation Jump to search
No edit summary
Line 68: Line 68:


* [https://www.tutorialspoint.com/perl/perl_regular_expressions.htm Perl Regular Expressions]
* [https://www.tutorialspoint.com/perl/perl_regular_expressions.htm Perl Regular Expressions]
* [https://wordmvp.com/FAQs/General/UsingWildcards.htm Using Wildcards in Word]

Revision as of 21:00, 19 January 2020

Find everything up to a tab

[^\t]+

Find capital letter, period, space, capital letter, period.

([A-Z]\.)[ ]([A-Z]\.)

Kill the space by using this for the replacement field:

$1$2

Find digit, period, space, digit.

([0-9]\.)[ ]([0-9])

Kill the space by using this for the replacement field:

$1$2

Perl: find uppercase words.

 \b[[:upper:]]{2,}\b

find capital letter at the end of a line, insert period before newline

(\s[[:upper:]])\n

\1\.^p

find period, capital letter at the end of a line

 (\.[[:upper:]])\n 

find lowercase characters one-at-a-time

([a-z])
\s\(([0-9]{4})

\s[[:upper:]]+\r

\L\1\n -- lowercases everything

\L2\1\n -- inserts 2, space, lowercase of the string

\L$2\1\n -- does not insert 2, lowercases string

\U\L\1\n -- lowercases everything

find ch.vv and change it to ch:vv:

^([0-9]+^).^([0-9]+^) = find things like 23.16

^1:^2 = change the period into a colon 23:16

find M-dash, space, 4-digit number

(\—[ ][0-9]{4})

find footnote marker, period; replace with footnote marker

search:  (^2).

replace: \1

Links

* Perl Regular Expressions * Using Wildcards in Word