Discussion:
Need help on square backets [ ] in sas perl regex on Z/OS
(too old to reply)
Sushil Nayak
2009-07-10 18:05:26 UTC
Permalink
Hi,
I am pretty old on windows SAS and with perl. I have just started working
on the SAS on Z/OS. While trying to create a sas perl regex on z/os i was
not able to use '/[a-z_\= ]+/i' on mainframes, as square brackets does not
show up on z/os. Im used to writting regex this way on windows sas but not
able to understand how would the above regex look like or should be written
on z/os.

The above regex is just an example, im trying to understand the square
bracket part only. Can someone please help me.

Thanks!
Chang Chung
2009-07-10 20:13:26 UTC
Permalink
On Fri, 10 Jul 2009 14:05:26 -0400, Sushil Nayak
<***@YAHOO.COM> wrote:
...
Post by Sushil Nayak
I am pretty old on windows SAS and with perl. I have just started working
on the SAS on Z/OS. While trying to create a sas perl regex on z/os i was
not able to use '/[a-z_\= ]+/i' on mainframes, as square brackets does not
show up on z/os. Im used to writting regex this way on windows sas but not
able to understand how would the above regex look like or should be written
on z/os.
The above regex is just an example, im trying to understand the square
bracket part only. Can someone please help me.
...
Hi,

If you run out of all other ways, then try sas regex, which is documented up
to 9.1 (but disappeared in 9.2). sas regex is specifically designed for sas
(thus uses $'...' instead of [...] for the character class, unlike prx which
is borrowed (and crippled!?) from perl.

Parts of Perl regex disabled in SAS are found at: http://tinyurl.com/nb5mnt
or http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a00232
6488.htm

Cheers,
Chang

data _null_;
length s $3;
do s = "abc", " ", "!!!", "= ";
rxid = rxparse("$'a-zA-Z_= '+");
rx=rxmatch(rxid, s);
prx = prxmatch("/[a-z_\= ]+/i", s);
put rx= prx= ;
end;
run;
/* on log
rx=1 prx=1
rx=1 prx=1
rx=0 prx=0
rx=1 prx=1
*/
Data _null_;
2009-07-10 20:35:55 UTC
Permalink
I don't know if this will work in those PERL REGEX's or not.

From the docs, on system option CHARCODE.


If you do not have the following symbols on your keyboard, you can use
these character combinations to create the symbols that you need when
CHARCODE is active:

To create: Use:
backquote (`) ?:
backslash (\) ?,
left brace ({) ?(
right brace (}) ?)
logical not sign (¬ or ^) ?=
left square bracket ([) ?<
right square bracket (]) ?>
underscore (_) ?-
vertical bar (|) ?/



--------------------------------------------------------------------------------

Examples


This statement produces the output [TEST TITLE]:

title '?<TEST TITLE?>';
Post by Sushil Nayak
Hi,
I am pretty old on windows SAS and with perl. I have just started working
on the SAS on Z/OS. While trying to create a sas perl regex on z/os i was
not able to use '/[a-z_\= ]+/i' on mainframes, as square brackets does not
show up on z/os. Im used to writting regex this way on windows sas but not
able to understand how would the above regex look like or should be written
on z/os.
The above regex is just an example, im trying to understand the square
bracket part only. Can someone please help me.
Thanks!
Schwarz, Barry A
2009-07-10 22:08:00 UTC
Permalink
z/Os has square brackets. The problem is usually a mismatch with the
code page your terminal emulator is using.

-----Original Message-----
From: Sushil Nayak [mailto:***@YAHOO.COM]
Sent: Friday, July 10, 2009 11:05 AM
To: SAS-***@LISTSERV.UGA.EDU
Subject: Need help on square backets [ ] in sas perl regex on Z/OS

Hi,
I am pretty old on windows SAS and with perl. I have just started
working
on the SAS on Z/OS. While trying to create a sas perl regex on z/os i
was
not able to use '/[a-z_\= ]+/i' on mainframes, as square brackets does
not
show up on z/os. Im used to writting regex this way on windows sas but
not
able to understand how would the above regex look like or should be
written
on z/os.
Sushil Nayak
2009-07-13 08:33:50 UTC
Permalink
Hey Guys,
Thanks for the input. I tried the solution provided by you all and had
googled some more to understand as to what could be the possible
alternative of square brackets on z/os as square brackets. The regex that
works on z/os and is equivalent to the regex on windows that i posted in my
earlier solution is :: '/Ýa-zA-Z_\= š+/i'

I got the conversion table from here ::
http://www.globalstatements.com/characterset/

Thanks again for all the inputs and help :)
d***@gmail.com
2018-03-26 14:02:15 UTC
Permalink
Post by Sushil Nayak
Hey Guys,
Thanks for the input. I tried the solution provided by you all and had
googled some more to understand as to what could be the possible
alternative of square brackets on z/os as square brackets. The regex that
works on z/os and is equivalent to the regex on windows that i posted in my
earlier solution is :: '/Ýa-zA-Z_\= ¨+/i'
http://www.globalstatements.com/characterset/
Thanks again for all the inputs and help :)
Sorry for replying to an old post but I faced the same problem and found the required hex codes, use X'AD' and X'BD' for '[' and ']'.
Loading...