<commit_before># /TypeScript extended RegExps/x

Extended (and genuinely-multi-line) Regular Expressions for JavaScript. Details at http://blog.mackerron.com/2010/08/08/extended-multi-line-js-regexps/.

Now available for TypeScript, where tagged template strings make them especially usable. The syntax is:

    xRegExp`myregexp`('flags');

And the flags `x` and `mm` are made available for extended and genuinely-multiline, in addition to the standard flags (`i`, `g`, etc.) which are simply passed through.

For example:
    
    import {xRegExp} from 'xregexps';
    
    const syncCodeRegExp = xRegExp`
      ^
      \s*
      ([^.]+)      # code 1
      [.]
      ([^.]+)      # code 2
      [.]
      ([0-9]{6})   # random seed
      [.]
      ([0-9]{4})   # start time
      [.]<commit_msg>Updated example with default import<commit_after># /TypeScript extended RegExps/x

Extended (and genuinely-multi-line) Regular Expressions for JavaScript. Details at http://blog.mackerron.com/2010/08/08/extended-multi-line-js-regexps/.

Now available for TypeScript, where tagged template strings make them especially usable. The syntax is:

    xRegExp`myregexp`('flags');

And the flags `x` and `mm` are made available for extended and genuinely-multiline, in addition to the standard flags (`i`, `g`, etc.) which are simply passed through.

For example:
    
    import xRegExp from 'xregexps';
    
    const syncCodeRegExp = xRegExp`
      ^
      \s*
      ([^.]+)      # code 1
      [.]
      ([^.]+)      # code 2
      [.]
      ([0-9]{6})   # random seed
      [.]
      ([0-9]{4})   # start time
      [.]
{'fraction_non_alphanumeric': 0.13135068153655513, 'fraction_numerical': 0.01982651796778191, 'mean_word_length': 2.6129753914988814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '157575', 'n_tokens_mistral': 537, 'n_tokens_neox': 496, 'n_words': 158}