Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > What Version Of Regex Does PSoC Creator Find/Replace Use?

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



What Version Of Regex Does PSoC Creator Find/Replace Use?
Moderator:
JFMD

Post Reply
Follow this topic



What Version Of Regex Does PSoC Creator Find/Replace Use?

gbmhunter posted on 05 May 2013 5:12 PM PST
Top Contributor
23 Forum Posts

 I am trying to use the "Use: Regular Expressions" option in the Find/Replace window to help find strings. 

 

However, when trying to use "negative lookbehind" to exclude certain words if they are preceded by a certain string (which is really helpful to prevent recursive find-replace when only adding/subtracting onto the start/end of a string (e.g. replacing "Test" with "ATest", and then the find/replace trying to replace the "Test" in "ATest" with "ATest" again, giving the erranous "AATest").

 

When I try "(?<!A)Test" (which means find every "Test" that isn't preceded by an "A"), I get the error "The given expression is invaid". However, this works fine in the online regex sandbox's (e.g. http://regex.powertoy.org/).

 

I was just wondering if anyone knew what version of Regex PSoC Creator uses?




Re: What Version Of Regex Does PSoC Creator Find/Replace Use?

hli posted on 06 May 2013 03:07 AM PST
Top Contributor
675 Forum Posts

When you press F1 in the find dialog, you get the help. From there, the Regex help is linked showing all allowed constructs.

In short: negation is done via '~', not '!'

But I just tried replacing 'test' with 'atest', and it replaced all occurences only once (as would be expected). What use case doesn't work for you, then?



Re: What Version Of Regex Does PSoC Creator Find/Replace Use?

gbmhunter posted on 06 May 2013 02:19 PM PST
Top Contributor
23 Forum Posts

It works if you use "Replace All", however, if you just use "Replace", because of a bug with Find/Replace, it can go back over previous material before searching through the entire project (I documented that bug here: cladlab.com/programming/microcontrollers/psoc/psoc-creator).

 

I tried the '~' symbol, but it didn't work. Even the example they gave didn't work! (that "reality" one). And evidence to suggest that '!' is negate, not '~', comes from the fact that negaitve lookahead does work. 

 

For example, "test(?!ing)" will match "test', "tester" and "atest", but not "testing" (as you would expect).



Re: What Version Of Regex Does PSoC Creator Find/Replace Use?

hli posted on 07 May 2013 12:04 AM PST
Top Contributor
675 Forum Posts

I cannot reproduce the problem with the find/replace dialog. I start with 'find next', it select the first match. When I press 'replace', the replacement happens and the selection jumps immediately to the next match. Which version of Creator are you using?

Apart from that, just file a support case (it looks like the documentation does not really match the implementation...)



Re: What Version Of Regex Does PSoC Creator Find/Replace Use?

gbmhunter posted on 07 May 2013 02:40 PM PST
Top Contributor
23 Forum Posts

 I think you have to have multiple files (and be using find/replace in a larger-than-just-the-single-file scope) for the problem to occur. I am using PSoC Creator v2.2.

O.K., I'll file a support case






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20