Adding Quantifiers to Lookaround Operators
- This topic has 2 replies, 2 voices, and was last updated 9 years, 4 months ago by .
- You must be logged in to reply to this topic.
Learn / Forums / InDesign User Groups / Adding Quantifiers to Lookaround Operators
Learn / Forums / InDesign User Groups / Adding Quantifiers to Lookaround Operators
Hi,
I have these two strings, below, and I would like to isolate the text, Daily Returns.
=[Piedmont daily.xlsx]Daily Returns!$C$15
=Daily Returns!$C$15
The expression to isolate the bits before Daily Returns is fairly simple:
\=(\[?.+\])?
But if I try to encapsulate this in a positive lookbehind operator, it fails. I’ve tried and tried and, well maybe I’m missing something obvious.
Lookbehinds cannot be greedy (ie you cant use quantifiers), lookaheads on the other hand can be greedy, but not lookbehinds, but you can use Keep or \K to mimic the positive lookbehind while using quantifiers, try:
\=(\[?.+\])?\K.+?(?=\!\$C\$\d+)
A. A. Ron,
Thanks, that works great! I’ve never heard of ‘Keep’; I shall have to learn more about it.
Thanks again,
Richard
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies allows us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.
You have to be logged in to save.
Not a member? Join Today - it's FREE!