Regex tricks: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
*Unpunctuated text: ([A-z ]{1,})
==Microsoft Word==
*Unpunctuated text with curly brackets: ([A-z \{\}]{1,})
Find unpunctuated text: ([A-z ]{1,})
===Newmanualising===
Find unpunctuated text with curly brackets: ([A-z \{\}]{1,})
<nowiki>/\{\{manual\|MI\|2002\|([^]]*)\|Section\|[^]]*\|comp\}\}/</nowiki> ==> <nowiki>{{isdamanual|$1}}</nowiki>


===Paragraph wrap===
===Paragraph wrap===
Find “paragraph 9(i)(a),” and wrap with prov tag:
Find “paragraph 9(i)(a),” and wrap with prov tag:
FInd:
Find: Paragraph <nowiki>([0-9\(\)][!.,; ]{1,})</nowiki>
Paragraph <nowiki>([0-9\(\)][!.,; ]{1,})</nowiki>
Replace: Paragraph <nowiki>{{nycsaprov|\1}}</nowiki>
Replace:
 
Paragraph <nowiki>{{nycsaprov|\1}}</nowiki>
If your numbering schema has full stops in it try this:
 
Find: Clause <nowiki>([0-9\(\).][!,; ]{1,})</nowiki>
Replace: Clause <nowiki>{{ietaprov|\1}}</nowiki>
 
===Indenting wikified autonumbering===
*In a word doc, make all your numbering reveal every level (eg “13(c)(vii)(B)” with the ferocity of a US securities lawyer. you can do this in the “Define Multilevel Lists” dialogue.
*Copy your whole doc into a text-only email. It will faithfully convert all those numbers to text. You will lose the indenting. We will put it back.
*Switch on Use wildcards in the replace dialogue.
:*Find: ^13([0-9]{1,}\([a-z,A-Z,0-9]{1,}\)\([a-z,A-Z,0-9]{1,}\)\([a-z,A-Z,0-9]{1,}\))
:*Replace: ^13:::\1
Then
:*Find: ^13([0-9]{1,}\([a-z,A-Z,0-9]{1,}\)\([a-z,A-Z,0-9]{1,}\))
:*Replace: ^13::\1
Then
:*Find: ^13([0-9]{1,}\([a-z,A-Z,0-9]{1,}\))
:*Replace: ^13:\1


===Search destroy===
Sorted.
Convert a fullanat2 into an ISDA anat:
 
/\{\{fullanat2\|isda\|([^]]*)\|2002\|[^]]*\|1992\}\}/ ==> <nowiki>{{isdaanat|$1}}</nowiki>
EVEN BETTER THAN THAT:
Delete a redundant  Equity Derivative Nuts:
In the define multilevel dialogue, add the necessary number of indenting colons into the actual word numbering
/\{\{eqderivanat\|([0-9]*.[0-9]*\([a-z]*\))}}/
 
/\{\{nuts\|Equity Derivatives\|[0-9]*.[0-9]*\([a-z]*\)\}\}/  ==> <nowiki>{{eqderivanat|$1}}</nowiki>
===Macro Magic===
===Tagging everything coloured blue===
===Tagging everything coloured blue===
#search and destroy
#search and destroy
Line 48: Line 63:


Mwah.
Mwah.
===Indenting wikified autonumbering===
==Mediawiki==
*In a word doc, make all your numbering reveal every level (eg “13(c)(vii)(B)” with the ferocity of a US securities lawyer. you can do this in the “Define Multilevel Lists” dialogue.
===Newmanualising===
*Copy your whole doc into a text-only email. It will faithfully convert all those numbers to text. You will lose the indenting. We will put it back.
Find: <nowiki>/\{\{manual\|MI\|2002\|([^]]*)\|Section\|[^]]*\|comp\}\}/</nowiki>
*Switch on Use wildcards in the replace dialogue.
Replace: <nowiki>{{isdamanual|$1}}</nowiki>
:*Find: ^13([0-9]{1,}\([a-z,A-Z,0-9]{1,}\)\([a-z,A-Z,0-9]{1,}\)\([a-z,A-Z,0-9]{1,}\))
===Search destroy===
:*Replace: ^13:::\1
Convert a fullanat2 into an ISDA anat:
Then
Find /\{\{fullanat2\|isda\|([^]]*)\|2002\|[^]]*\|1992\}\}/
:*Find: ^13([0-9]{1,}\([a-z,A-Z,0-9]{1,}\)\([a-z,A-Z,0-9]{1,}\))
Replace<nowiki>{{isdaanat|$1}}</nowiki>
:*Replace: ^13::\1
Delete a redundant  Equity Derivative Nuts:
Then
Find: /\{\{eqderivanat\|([0-9]*.[0-9]*\([a-z]*\))}}/
:*Find: ^13([0-9]{1,}\([a-z,A-Z,0-9]{1,}\))
/\{\{nuts\|Equity Derivatives\|[0-9]*.[0-9]*\([a-z]*\)\}\}/ 
:*Replace: ^13:\1
Replace: <nowiki>{{eqderivanat|$1}}</nowiki>
 
Sorted.

Navigation menu