Skip to content

Instantly share code, notes, and snippets.

@booyaa
Last active August 29, 2015 14:02
Show Gist options
  • Save booyaa/831be0a74b99288cdf87 to your computer and use it in GitHub Desktop.
Save booyaa/831be0a74b99288cdf87 to your computer and use it in GitHub Desktop.
Reuters Magick

#Regex to convert Ratings ENUM into a CSV

Works for Notepad++ regex which is POSIXy.

Assume data looks like this:

enumtype.def:
      0       "    "   Not allocated
      1       "AAA "   The obligor's capacity to meet its financial commitment on the obligation is extremely strong.
      2       "AA+ "   The obligor's capacity to meet its financial commitment on the obligation is very strong.
      3       "AA  "   The obligor's capacity to meet its financial commitment on the obligation is very strong.
      4       "AA- "   The obligor's capacity to meet its financial commitment on the obligation is very strong.

Find what: (\d+)\s+(\".*\")\s+(.*) Replace with: \1,\2,"\3"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment