Regex tricks: Difference between revisions
Jump to navigation
Jump to search
Amwelladmin (talk | contribs) No edit summary |
Amwelladmin (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
/\{\{fullanat2\|isda\|([^]]*)\|2002\|[^]]*\|1992\}\}/ ==> <nowiki>{{isdaanat|$1}}</nowiki> | /\{\{fullanat2\|isda\|([^]]*)\|2002\|[^]]*\|1992\}\}/ ==> <nowiki>{{isdaanat|$1}}</nowiki> | ||
Delete an Equity Derivative Nuts: | Delete an Equity Derivative Nuts: | ||
/\{\{nuts\|Equity Derivatives\|[0-9]*.[0-9]*\([a-z]*\)\}\}/ ==> | /\{\{eqderivanat\|([0-9]*.[0-9]*\([a-z]*\))}}/ | ||
/\{\{nuts\|Equity Derivatives\|[0-9]*.[0-9]*\([a-z]*\)\}\}/ ==> {{eqderivanat|$1}} | |||
===Tagging everything coloured blue=== | ===Tagging everything coloured blue=== | ||
#search and destroy | #search and destroy |
Revision as of 12:18, 18 January 2020
Seach destroy
Convert a fullanat2 into an ISDA anat:
/\{\{fullanat2\|isda\|([^]]*)\|2002\|[^]]*\|1992\}\}/ ==> {{isdaanat|$1}}
Delete an Equity Derivative Nuts:
/\{\{eqderivanat\|([0-9]*.[0-9]*\([a-z]*\))}}/ /\{\{nuts\|Equity Derivatives\|[0-9]*.[0-9]*\([a-z]*\)\}\}/ ==> Template:Eqderivanat
Tagging everything coloured blue
- search and destroy
- double spaces
- Fields (ctrl-shift-F9)
- bookmarks - there's a cool macro for this:
Sub RemoveAllBookmarks() Dim objBookmark As bookmark For Each objBookmark In ActiveDocument.Bookmarks objBookmark.Delete Next End Sub
- . Clear out all blue dashes - replace them with xxx
- . Clear out all blue apostrophes - replace them with yyy
- . Clear ot all blue spaces - replace them with qqq (this won't do the ones either side of the blue phrase)
- Find: ([A-Z][a-z]{1,}) ([A-Z][a-z]{1,}) (use wildcards, font colour: blue)
- Replace: \1qqq/2
- . Now your tags are all continuous blue strings. So brace them:
- Find: <(?{1,})> (use wildcards, font colour: blue)
- Replace: {{wikitag|\1}} (font colour blue)
Now restore spaces, apostrophes and dashes.
Mwah.
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
Sorted.