mlevison Posted December 12, 2024 Posted December 12, 2024 I want to create a series of Text Actions for the clipboard. The regex is roughly: ^\s*(•|·|▪|●|♦|-|–|−|¬|¬)\s+ I have created a Universal Action - I can't see if my failure is the Regex or getting the result back to the Clipboard. How do I debug?
FireFingers21 Posted December 12, 2024 Posted December 12, 2024 @mlevison Your Replace Utility is set to replace string, it should be set to replace regex. Also be mindful of reserved characters like the hyphen, which need to be escaped if used literally. I was able to remove all the specified bullets with the following regex: (•|·|▪|●|♦|\-|–|−|¬|¬)
vitor Posted December 12, 2024 Posted December 12, 2024 Since everything is a single character, square brackets would make more sense than parenthesis and pipes.
mlevison Posted December 14, 2024 Author Posted December 14, 2024 (edited) Thanks - fixed the String vs Regex. Something still isn't working. Now the Replace dialog looks like: When I run it against this text: Burnout exhibits three dimensions: Exhaustion; Lack of Productivity; Cynicism Burnout is caused by chronic unrelenting stress. Stress that comes from feeling that there is no end in sight Cynisim becomes the easy way out when we don't have the mental resources to cope. 6 Factors that lead to burnout - Workload - is the volume of work we have sustainable - ties into the Agile Manifesto and Sustainable pace - Lack of Control - ties into [[Autonomy]] (i.e. ability to shape the projects we work on) . Having multiple bosses or multiple sources of work reduces control. - Insufficient Reward - Underpaid, lack of recognition the **Status** portion of the [[SCARF]] model - Community - are you connected with the people at work and outside of work - the **Relatedness** portion of both [[SCARF]] and [[ARC]] - Fairness - are you treated fairly - Values - are your personal values in alignment with the ones at work I would expect it to remove the the first "-" and leave the rest of the text intact. The results I see in the Debugger window seem to suggest that my Regex isn't doing anything. Regex continues to confuse me after nearly 40yrs of use. Edited December 14, 2024 by mlevison
vitor Posted December 14, 2024 Posted December 14, 2024 You either use parenthesis and pipes, like you had, or square brackets only. It’s the difference between (a|b|c) and [abc].
zeitlings Posted December 15, 2024 Posted December 15, 2024 (edited) ^\s*[•·▪●♦\-–−¬¬]\s+ This one should work. Don't forget to check the Multi-line option! Edit: To catch more bullet options (esp. + and *, which are common in Markdown) ^\s*[•·●○◦⚫⭘∘∙⋅▪■□◆♦◇▫▹▸\-–—−―‒⁃▬▭▯►➢➤➣→⇒▶▷※⁂☆★✓✗❖◈⬧*+]\s+ Edited December 15, 2024 by zeitlings sepulchra 1
Stephen_C Posted December 15, 2024 Posted December 15, 2024 There are websites where you can test your RegEx—like this one. I find them quite useful when wrestling with RegEx. Stephen sepulchra 1
mlevison Posted December 15, 2024 Author Posted December 15, 2024 @zeitlings Nice that did the trick @Stephen_Cthanks - I tried to use one. There are two challenges - the small - proving the site is using the same flavour of regex as your tool. The bigger one - you can tell when your regex doesn't work. It doesn't tell you why it didn't work. Ideally there would a regex generator. I feed it an input/result state and it generates the regex.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now