Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
regex [2021/03/19 08:47] niklasregex [2021/03/19 08:57] niklas
Line 1: Line 1:
-**Clean paragraph tags**+====== Useful regular expressions ====== 
 + 
 +=====Clean paragraph tags=====
 Replace Replace
 <code><p[^>]+></code> <code><p[^>]+></code>
 with  with 
 <code><p></code> <code><p></code>
-**remove span tags:**+=====remove span tags:=====
 Replace Replace
 <code><[/]?span[^>]*></code> <code><[/]?span[^>]*></code>
 with nothing with nothing
  
-**Remove empty paragraph tags:**+=====Remove empty paragraph tags:=====
 Replace Replace
 <code><p[^>]*>&nbsp;</p></code> <code><p[^>]*>&nbsp;</p></code>
Line 18: Line 20:
 with nothing with nothing
  
-**Bold paragraphs to h4:**+=====Bold paragraphs to h4:=====
 Replace Replace
 <code> <code>
Line 27: Line 29:
 <h4>\1</h4> <h4>\1</h4>
 </code> </code>
-**Handling footnotes:**+=====Handling footnotes:=====
 <code> <code>
 <a (href="#_ftn[0-9]") (name="_ftnref[0-9]") title=""></a>(\[[0-9]\]) <a (href="#_ftn[0-9]") (name="_ftnref[0-9]") title=""></a>(\[[0-9]\])
Line 48: Line 50:
 \1<sup><a name="_ftnref\2" /><a href="#_ftn\2">\2</a></sup>\3 \1<sup><a name="_ftnref\2" /><a href="#_ftn\2">\2</a></sup>\3
 </code> </code>
-**Finding and replacing double quotation:**+=====Finding and replacing double quotation:=====
 <code> <code>
 (?<!\=)"((?!"|'')[^"\n>]*)("|'')(?!>)(\W) (?<!\=)"((?!"|'')[^"\n>]*)("|'')(?!>)(\W)
Line 59: Line 61:
 <code>‘\1’\3</code> <code>‘\1’\3</code>
  
-**Removing line breaks in code:**+=====Removing line breaks in code:=====
 This is useful if above isn't working because of line breaks. This is useful if above isn't working because of line breaks.
 Replace  Replace