1.1.5 • Published 2 years ago

sr_match_capture v1.1.5

Weekly downloads
5
License
UNLICENSED
Repository
github
Last release
2 years ago

match-capture - apply match instructions, capture match results

matchArr_match function used to match and capture according to array of match instructions.

  import { iMatchCapture, iMatchItem, matchArr_match } from 'sr_match_capture';

  // matchArr. repeating keyword enclosed values.
  const arr: iMatchItem[] = [
    { oper: 'identifier', captureName: 'keyword', zeroMoreWhitespace: true },
    { oper: 'text', text: '(', zeroMoreWhitespace: false },
    { oper: 'repeatBegin', captureName:'args'},
    { oper: 'identifier', doCapture:true, zeroMoreWhitespace: true },
    { oper: 'or' },
    { oper: 'literal', doCapture:true, zeroMoreWhitespace: true },
    { oper: 'repeatMatchText', text:':', zeroMoreWhitespace:true},
    { oper: 'repeatEnd' },
    { oper: 'text', text: ')', zeroMoreWhitespace: true },
  ]
  const text = 'overlay(sditno:jim:25)';
  const match = matchArr_match(text, 0, arr );
  const { keyword, args } = match.capture ;
1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago