Digital Developer Conference: a FREE half-day online conference focused on AI & Cloud – North America: Nov 2 – India: Nov 9 – Europe: Nov 14 – Asia Nov 23 Register now

Close outline
  • United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.195

DevOps Build×

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

How to use regular expressions in search in files in Application Discovery?

310002PRW4 gravatar image
Question by DANL_M  (1) | Aug 02, 2017 at 11:41 PM addi

In Application Discovery, using search in file function, how can I use regular expressions to perform ANDing and ORing? Suppose I want to search for all IF statements that set variable A or set variable B in the THEN clause. Can this be constructed?

so I want a reg exp that would traps these two statements

ie. IF X=1 THEN A=2 IF Y=2 THEN B=3

but not
IF X=3 THEN C=1

thank you

People who like this

  0
Comment
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster

2 answers

  • Sort: 
503QXGDTGT gravatar image

Answer by JigaranuEduard (16) | Aug 04, 2017 at 04:54 AM

Hello @DANL_M.

I've done a more search and extended testing and I have found that:

  • checking the "Regular expression" in the "Search in files" Explorer option can help you ONLY if you are searching for a regular expression or syntax keyword that has been indexed already (so the search is done ONLY in the index containing the key words treated as regular expression; eg: from a code file the index will extract only keywords such if, then, else, do, when, dcl, return, etc and the search will match only the terms existing in this index)

  • as soon as you are entering some text like "A=" or anything else, the regular expression is of no use as it is not a keyword; I would strongly suggest to use simple search without resorting to the "regular expression" as it will search in all the file

  • also, please bear in mind that if the searched terms are in different lines, the result will contain the first term and the line where is present - eg: you search for "then m_txt !!= '11'x" in the code like if(length(trim(var_a.txt)) > 0) then m_txt !!= '11'x !! 'FN ' !! trim(var_a.txt); aktLL = length(m_txt); if(^writeLine()) then return(false); you will be shown only the line containing the first term - then in our case see image sif-eg.png attached. alt text


sif-eg.png (49.2 kB)
Comment
Alayna P. Edwards

People who like this

  1   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
503QXGDTGT gravatar image

Answer by JigaranuEduard (16) | Aug 03, 2017 at 10:45 AM

@DANL_M.

The OR-ing can be done using either comma "," or space" ".

I am not aware of any AND. Below you can find a list of possibilities for the search in files option in the Analyze Client:

For searching you can use 'simple text' term or regular expressions. Note: When 'regular expressions' option is checked regular expression matching is also done for file name.

For 'simple text' the following functionalities are implemented: ',' (comma) means OR: searching for 'termA,termB' will show occurrences (and files) that match any of the terms; ' ' (space) means consecutive terms: searching for 'termA termB' will show only occurrences that match both terms in this exact order. Space(s) right after comma is(are) ignored and multiple spaces are trimmed - considered as one; '?' means any one character: searching for 'abc?' will show occurrences of all 4 characters terms where the first three are 'abc'; '' means any term or any number of characters part of a term - this is so because searching/matching is done on indexed terms and not full text and a term is any sequence of valid characters delimited by separators. To see what characters are considered as a valid part of a term (and not a separator - ignored) see isJavaIdentifierPart(char ch) - to that the following characters are added: @,-,#. This means that characters like '', '(', ')', ','(comma), ':', '=' etc. are ignored(considered separators);

These can be mixeed.

For regular expressions: ',' (comma) means the same thing as above: 'regEx1,regEx2' is equivalent to 'regEx1|regex2'; ' ' (space) means the same thing as above; Note: the search term (both simple text and regular expression) has to fully match and indexed term to obtain a result. This actually means something in regular expression context where if you use something like an online regex validator/tester for the regex 'term' you will match 'term' plus any word containing 'term' (terms, terminates) for Search in files using regular expressions this is not the case - searching for 'term' will only show occurrences of 'term'. To obtain the same behavior you would have to use a regular expression like 'term\w*'.

HTH

Comment

People who like this

  0   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster

Follow this question

113 people are following this question.

Answers

Answers & comments

Related questions

Where can I find the log files for IBM Application Discovery Analyze client? 1 Answer

Advice for slow graph generation 1 Answer

What type of reports can I generate for mainframe projects in IBM Application Discovery Analyze client? 1 Answer

Eclipse(IDz, RDz or zOS Explorer) clients aren't prompting to choose workspace at startup. Is there a workaround? 1 Answer

Application Discovery Services start and then immediately stop 1 Answer

  • Contact
  • Privacy
  • IBM Developer Terms of use
  • Accessibility
  • Report Abuse
  • Cookie Preferences

Powered by AnswerHub

Authentication check. Please ignore.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • API Connect
  • Analytic Hybrid Cloud Core
  • Application Performance Management
  • Appsecdev
  • BPM
  • Blockchain
  • Business Transaction Intelligence
  • CAPI
  • CAPI SNAP
  • CICS
  • Cloud Analytics
  • Cloud Automation
  • Cloud Object Storage
  • Cloud marketplace
  • Collaboration
  • Content Services (ECM)
  • Continuous Testing
  • Courses
  • Customer Experience Analytics
  • DB2 LUW
  • Data and AI
  • DataPower
  • Decision Optimization
  • DevOps Build
  • DevOps Services
  • Developers IBM MX
  • Digital Commerce
  • Digital Experience
  • Finance
  • Global Entrepreneur Program
  • Hadoop
  • Hybrid Cloud Core
  • Hyper Protect
  • IBM Cloud platform
  • IBM Design
  • IBM Forms Experience Builder
  • IBM Maximo Developer
  • IBM StoredIQ
  • IBM StoredIQ-Cartridges
  • IIDR
  • ITOA
  • InformationServer
  • Integration Bus
  • Internet of Things
  • Kenexa
  • Linux on Power
  • LinuxONE
  • MDM
  • Mainframe
  • Messaging
  • Node.js
  • ODM
  • Open
  • PartnerWorld Developer Support
  • PowerAI
  • PowerVC
  • Predictive Analytics
  • Product Insights
  • PureData for Analytics
  • Push
  • QRadar App Development
  • Run Book Automation
  • Search Insights
  • Security Core
  • Storage
  • Storage Core
  • Streamsdev
  • Supply Chain Business Network
  • Supply Chain Insights
  • Swift
  • UBX Capture
  • Universal Behavior Exchange
  • UrbanCode
  • WASdev
  • WSRR
  • Watson
  • Watson Campaign Automation
  • Watson Content Hub
  • Watson Marketing Insights
  • dW Answers Help
  • dW Premium
  • developerWorks Sandbox
  • developerWorks Team
  • Watson Health
  • More
  • Tags
  • Questions
  • Users
  • Badges