EG 6.1 M1 (6.100.0.4025) (32-bit)
I pasted a bunch of text from Excel (list of variable names, one per line) into EG.
I now want to make them comment headers for each code block.
So, I tried: Cntl-H, Find text = ^, Replace with = \* , tick Regular expression search, click Replace All (or Replace in Selection).
Error message "Cannot find the string "^" ".
Tried the same using the "right arrow/play button" pulldown for ^ Start of line. Same error.
Also tried: Find text = $, Replace with = ; . Same error.
Workaround: paste into Textpad, search and replace (F8), do the same thing as above, it works fine. Paste back into EG.
(In Textpad, Find text = ^(.*)$, Replace text = \* \1 ; does it all in one search and replace, which is kind of cool.)
Can anyone comment 1) if they also experience this issue in EG 6.x, and 2) is it fixed in later releases?
You are actually running into two limitations of the Find/Replace dialog in the EG editor...
1) It doesn't currently handle zero-width regular expression matches (such as lone ^ and $). If you use those anchors in regular expressions that return greater-than-zero-width matches, it'll find the matches just fine.
2) It doesn't currently allow regular expression substitutions in the replacement text. (ex. a capture)
We are aware of both of these limitations (which still exist in the latest version of EG) and hope to be able to address them in a future release.
Casey
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
The regular expression parser in the editor seems to be only a subset of regular expressions.
Part of the issue with the search and replace in the editor is that it has to handle the non-regular expressions as well.
You might be able to use
Search for \n
Replace \n/*
for the start of a line
or search \n
replace */\n for end of line
but generally I would find the editor Ctrl-/ on a block or line of text easier.
You are actually running into two limitations of the Find/Replace dialog in the EG editor...
1) It doesn't currently handle zero-width regular expression matches (such as lone ^ and $). If you use those anchors in regular expressions that return greater-than-zero-width matches, it'll find the matches just fine.
2) It doesn't currently allow regular expression substitutions in the replacement text. (ex. a capture)
We are aware of both of these limitations (which still exist in the latest version of EG) and hope to be able to address them in a future release.
Casey
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.