cannedtuna@lemmy.world to memes@lemmy.worldEnglish · 5 days agoExpressionslemmy.worldimagemessage-square37linkfedilinkarrow-up1522arrow-down19
arrow-up1513arrow-down1imageExpressionslemmy.worldcannedtuna@lemmy.world to memes@lemmy.worldEnglish · 5 days agomessage-square37linkfedilink
minus-squareBiscuityCat@lemmy.worldlinkfedilinkarrow-up4·edit-24 days agoYou are right. It is just removal of the bracketed text. The input is multi-line string, so only flag used was the multi-line mode. These are string lines I have encountered and how I wanted to change them: 1. "[...]" -> "" 2. "-[...]" -> "" 3. "-[...] text" -> "-text" 4. "-text [...]" -> "-text" 5. "[...] text [...]" -> "text" 6. "-[...] text [...]" -> "-text" The main point is that I needed to remove the dash only if there is no other text on the line. I have tried the regex you are suggesting at the beginning, but it failed at points (3) and (6). EDIT: It just occurred to me that the first line of my comment sounds like stupid AI. 🤦
minus-squarelime!@feddit.nulinkfedilinkarrow-up1·3 days agoaaah i see. then a conditional makes sense if you need to one-shot it. personally i would have run it through twice but i know there are systems that don’t allow that.
You are right. It is just removal of the bracketed text. The input is multi-line string, so only flag used was the multi-line mode.
These are string lines I have encountered and how I wanted to change them:
1. "[...]" -> "" 2. "-[...]" -> "" 3. "-[...] text" -> "-text" 4. "-text [...]" -> "-text" 5. "[...] text [...]" -> "text" 6. "-[...] text [...]" -> "-text"The main point is that I needed to remove the dash only if there is no other text on the line.
I have tried the regex you are suggesting at the beginning, but it failed at points (3) and (6).
EDIT: It just occurred to me that the first line of my comment sounds like stupid AI. 🤦
aaah i see. then a conditional makes sense if you need to one-shot it. personally i would have run it through twice but i know there are systems that don’t allow that.