MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using FIND with a regular expression

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Apr 12, 2018 5:33 am    Post subject: Using FIND with a regular expression Reply with quote

I must be doing something wrong, becuase I think I should be getting a hit, but I don't.
Assume I have a number of lines in my source containing
Code:
copy copybook

If I ensure the cursor is above these lines, shouldn't the following find the string ?
Quote:
find r'c.py'

or am I missing something ?

Assuming I get some help, I have a follow on question. Let's assume I want to find the following string (where the ? is any character)
Quote:
copy ?????aa.'

(note the trailing dot in the search string).
Since the dot is used as "any" character in regular expressions, can I indicate that the last trailing character is a dot and not just any character.

Update. Have asked support if I have the C runtime library allocated which is required for this to work.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Apr 12, 2018 3:04 pm    Post subject: Re: Using FIND with a regular expression Reply with quote

misi01 wrote:
I must be doing something wrong, becuase I think I should be getting a hit, but I don't.
Assume I have a number of lines in my source containing
Code:
copy copybook

If I ensure the cursor is above these lines, shouldn't the following find the string ?
Quote:
find r'c.py'

or am I missing something ?


misi01,

Yes that should have found Copy copybook

misi01 wrote:

Update. Have asked support if I have the C runtime library allocated which is required for this to work.


If you are running ispf 2.1 you should automatically be able to use regular expressions provided you are using one of the following code page listed here

https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.f54em00/useofr1.htm


[quote="misi01"]
Assuming I get some help, I have a follow on question. Let's assume I want to find the following string (where the ? is any character)
Quote:
copy ?????aa.'
(note the trailing dot in the search string).
Since the dot is used as "any" character in regular expressions, can I indicate that the last trailing character is a dot and not just any character.


lets you say have you his sample data

Code:

baa
ccaa
dddaa
eeeeaa
fffffaa
ggggggaa
1aa
22aa
33daa
4444aa
55555aa
666666aa


If you want find anything with a suffix off 'aa' and limit to a thru z for the characters preceding 'aa', then you issue the command
Code:

f r'[a-z]aa'


If you want to find anything with numerics then issue the following command

Code:

f r'[a-z]aa|[0-9]aa'


but if you want to narrow it down to have a minimum of 5 characters before the suffix 'aa' then issue the following command
Code:

f r'[a-z]{5}aa'

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group