Skip to content

Instantly share code, notes, and snippets.

@mvogelgesang
Last active December 22, 2020 18:46
Show Gist options
  • Save mvogelgesang/8890010a05e614c4f953b28e4e8b1c41 to your computer and use it in GitHub Desktop.
Save mvogelgesang/8890010a05e614c4f953b28e4e8b1c41 to your computer and use it in GitHub Desktop.

Dates

YYYY-MM-DD

^(((19|20)\d{2})\-(0?[1-9]|1[0-2])\-(0?[1-9]|1\d|2\d|3[01])$)

MM/DD/YYYY

^$|((0?[1-9]|1[0-2])\/(0?[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$)

JSON

Find JSON Object Containing Term

Given an object, find a field (HostingProvider) with the value, Salesforce. This will fetch the whole object and trailing comma {.*?"HostingProvider":"Salesforce”.*?},

Find JSON Objects NOT Containing Term

Given an object, find a field, HostingProvider, that does not have the value Salesforce. This will fetch the whole object and the trailing comma {.*?"HostingProvider":"((?!Salesforce).).*?},

Miscellaneous Text Operations

Insert Character Before Sequence

Say you want to insert a line break before every number that appears. For example:

1 Sagan Peter 2 Woods Michael ... 13 Skuijins Toms

Find: (\d+) Replace: \n$& Result: 1 Sagan Peter 2 Woods Michael ... 13 Skuijins Toms

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