14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

574 JSL Syntax Reference Appendix A<br />

Character Pattern Functions<br />

Returns<br />

A pattern.<br />

Argument<br />

One or more patterns.<br />

Pat Any("string")<br />

Description<br />

Constructs a pattern that matches a single character in the argument.<br />

Returns<br />

A pattern.<br />

Argument<br />

string a string.<br />

Pat Arb()<br />

Description<br />

Constructs a pattern that matches an arbitrary string. It initially matches the null string. It then matches<br />

one additional character each time the pattern matcher backs into it.<br />

Returns<br />

A pattern.<br />

Argument<br />

none<br />

Example<br />

p = "the beginning" + Pat Arb() >? stuffInTheMiddle + "the end";<br />

Pat Match("in the beginning of the story, and not near the end, there are three<br />

bears", p);<br />

show(stuffInTheMiddle);<br />

stuffInTheMiddle = " of the story, and not near "<br />

Pat Arb No(pattern)<br />

Description<br />

Constructs a pattern that matches zero or more copies of pattern.<br />

Returns<br />

A pattern.<br />

Argument<br />

pattern a pattern to match against.<br />

Example<br />

adjectives = "large" | "medium" | "small" | "warm" | "cold" | "hot" | "sweet";<br />

rc = Pat Match("I would like a medium hot, sweet tea please",<br />

Pat Arbno(adjectives | Pat Any(", ")) >> adj +<br />

("tea" | "coffee" | "milk"));<br />

show(rc, adj);<br />

adj = " medium hot, sweet "

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

Saved successfully!

Ooh no, something went wrong!