Lookahead, yes. Lookbehind, no. On Wednesday, February 24, 2021 at 3:22:06 AM UTC-5 [email protected] wrote:
> All excellent pointers. Thank you all. I have to assume I can use > lookahead and lookbehind assertions in JavaScript, either natively or via a > node library, but wasn't sure how to phrase the question to begin with. > > Kind regards, > > Ted > > On Wed, Feb 24, 2021 at 7:57 AM jj <[email protected]> wrote: > >> Hi Ted, >> >> BBEdit regular expressions are based on PCRE2 (see credits in 'BBEdit >> about'). >> >> For quick reference the BBEdit Help is excellent: 'Help menu' > BBEdit >> Help > Quick Reference > Grep Reference. >> For the definitive documentation on PCRE: >> https://www.pcre.org/current/doc/html/pcre2syntax.html >> And for JavaScript: >> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet >> >> You can also test and compare your regular expressions in this excellent >> playground : https://regex101.com >> >> Best regards, >> >> Jean Jourdain >> >> >> On Wednesday, February 24, 2021 at 6:37:09 AM UTC+1 Harvey Pikelberger >> wrote: >> >>> Re non-capturing parentheses, this might help: >>> https://stackoverflow.com/questions/3512471/what-is-a-non-capturing-group-in-regular-expressions >>> >>> For the most part RegEx in JS & BBEdit are much the same. The big >>> difference is that in JS vs BBEdit is the syntax for the backreference. >>> (\ (backslash) in BBEdit vs $ in JS) >>> >>> So for example say your Find is "AE" plus a 3rd uppercase character >>> [A-Z], followed by a number [0-9], where you want to inserted new text >>> between the letters and numbers... >>> >>> In BBEdit that would be Find: *(AE[A-Z])([0-9])* Replace: >>> *\1InsertedNewText\2* >>> In JS the same thing is: SomeText.replace(/(AE[A-Z])([0-9])/g, >>> $1InsertedNewText$2); >>> >>> >>> >>> >>> >>> On Feb 23, 2021, at 1:43 PM, Ted Stresen-Reuter <[email protected]> >>> wrote: >>> >>> I'm trying to do some advanced parsing of source code using RegEx. I'm >>> using non-capturing parentheses "(?…)" and friends for look aheads and look >>> behinds and such. I'm wondering if anyone can tell me: >>> >>> 1. What type of RegEx extension are these types of patterns (look >>> aheads, look behinds)? >>> 2. Is there an equivalent that could be used in JavaScript, say, in a >>> node application? >>> >>> >>> -- >> This is the BBEdit Talk public discussion group. If you have a feature >> request or need technical support, please email "[email protected]" >> rather than posting here. Follow @bbedit on Twitter: < >> https://twitter.com/bbedit> >> --- >> You received this message because you are subscribed to the Google Groups >> "BBEdit Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/bbedit/f5e5f412-27c5-405d-ba8c-5067319e0221n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/bbedit/f5e5f412-27c5-405d-ba8c-5067319e0221n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/16520b24-ea8f-45fe-b346-a5b878ded054n%40googlegroups.com.
