14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix A JSL Syntax Reference 575<br />

Character Pattern Functions<br />

Pat At(varName)<br />

Description<br />

Constructs a pattern that matches the null string and stores the current position in the source string into<br />

the specified JSL variable (varName). The assignment is immediate, and the variable can be used with<br />

expr() to affect the remainder of the match.<br />

Returns<br />

A pattern.<br />

Argument<br />

varName the name of a variable to store the result in.<br />

Example<br />

p = ":" + Pat At(listStart) + expr(if(listStart==1, Pat Immediate(Pat Len(3),<br />

early), Pat Immediate(Pat Len(2), late)));<br />

early = ""; late = "";<br />

Pat Match(":123456789", p);<br />

show(early,late); early = ""; late = "";<br />

Pat Match(" :123456789", p);<br />

show(early,late);<br />

First this is produced:<br />

early = "123"<br />

late = ""<br />

and later this:<br />

early = ""<br />

late = "12"<br />

Pat Break("string")<br />

Description<br />

Constructs a pattern that matches zero or more characters that are not in its argument; it stops or breaks<br />

on a character in its argument. It fails if a character in its argument is not found (in particular, it fails to<br />

match if it finds the end of the source string without finding a break character).<br />

Returns<br />

A pattern.<br />

Argument<br />

string a string.<br />

Pat Concat(pattern1, pattern2 )<br />

Pattern1 + Pattern2 + ...<br />

Description<br />

Constructs a pattern that matches each pattern argument in turn.<br />

Returns<br />

A pattern.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!