Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PCRE 1.52 KB | None | 0 0
  1. # regex for use with boost regex engine (e.g. Notepad++)
  2. # To convert this pseudo-free-spaced text file to a "Find what" and "Replace with" usable in Notepad++, replace the following with nothing using Notepad++:
  3. # \t|\R(?!\R)| +#.*|^#.*\R
  4.     (?:
  5.         ^system(?'is_system')
  6.     |
  7.         \G(?'first_of_this_type'\R)?\t
  8.         (?:
  9.             link(?'is_link')
  10.         |
  11.             \t*object(?'is_object')
  12.         )
  13.     )
  14.      (?|"(?'name'[^"]*)"|(?'name'.*))
  15.     (?('is_system')\R\tpos (?'xpos'\S+) (?'ypos'\S+))
  16.     (?:
  17.         (?:\k'is_system'|\k'is_link')
  18.         (?=
  19.             (?:
  20.                 \R?^\t
  21.                 (?:
  22.                     link (?'link_follows')
  23.                 |
  24.                 ).*
  25.             )*
  26.         )
  27.     )?
  28.     (?'is_link_or_object'
  29.         \k'is_link'(?:\R(?=\tlink )|(?'is_last_link'))     # advance to next link in such a way that we'll know when we reach it that it's not the first one
  30.     |
  31.         \k'is_object'(?:                                   # advance to next object in such a way that we'll know when we reach it that it's not the first one
  32.             (?:\R\t.*)*?
  33.             \R(?=\t+object )
  34.         )?
  35.     )?
  36. |
  37.     ^\S.*                                                  # comment, or top-level thing that's not a system
  38.     (?:\R\t.*)*
  39. |
  40.     \G\R\t.*
  41. |
  42.     ^\R
  43.  
  44. (?{is_link_or_object}(?{first_of_this_type}:,))            # comma between link/object names
  45. $+{name}
  46. (?{is_system}
  47.     \t$+{xpos}\t$+{ypos}
  48.     \t                                                     # tab before links
  49.     (?{link_follows}:\t)                                   # tab before objects, in case of no links
  50. )
  51. (?{is_last_link}\t)                                        # tab before objects, after last link
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement