validating-a-url.rex

Pipelines v2.1

 

.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...

Home

     **** Top of file ****
   1
   2 /* The following pipeline is an example of a script which validates a URL.
   3    The locate stage employs a simple regular expression which it applies against each
   4    input record; to validate the specified address. */
   5
   6 Address Rxpipe
   7
   8 'pipe (endchar ? escape % regex 3 stagesep |)',
   9      'literal \http://www.1052.co.uk/pipelines/\',
  10      '| lit \http: //pipelines.co.uk/\',
  11      '| lit \https://www.microsoft.com\',
  12      '| a: locate reg "^(http)(s%?)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)%?$"',
  13      '| specs /Valid URL:/ 1 1-* nw',
  14      '| console',
  15      '?',
  16      'a:',
  17      '| specs /Invalid URL:/ 1 1-* nw',
  18      '| console'
  19
  20 Say 'Hit Enter to close..'
  21 Parse Pull
  22
  23 Exit 0
     **** End of file ****