[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
RegEx - find and replace strings

You are currently reading a thread in /wsr/ - Worksafe Requests

Thread replies: 11
Thread images: 1
File: 2016-05-22 18_33_09-2.png (79 KB, 1260x841) Image search: [Google]
2016-05-22 18_33_09-2.png
79 KB, 1260x841
I want to fully replace multiple Anki field strings using RegEx, but I get weird results (either errors or multiple repetitions of what I want to insert, instead of just one instance).

The fields have very different strings in them.

How do I get rid of the field contents and replace them with something else?

I tried those commands, individually:
*
.*
^.*$
>>
Addendum: I think I get all those repetitions because every single character of the original field gets turned into the string I want to replace it with.
>>
I basically need a way to "nuke and replace", instead of "find and replace", because I don't care what's already in the field.
>>
>>126631
<anything>* <end of file>
>>
>>126833
That corresponds to the third command:
^.*$

It does nothing.
>>
>>126631
Clearly Anki's regex engine is a load of worthless shit.

Export it to JSON, CSV, etc. then use sed.
>>
>>126826
>>126635
Replace .* with a
Replace aa with a, until every field contains only a
Replace a with your payload
>>
>>126870
I want to use exporting as a last resort.

>>126872
I'll try that later.
>>
>>126883
Just learn AWK once, and you'll never again have a problem like this in your entire life.
>>
>>126910
What does AWK stand for?
>>
>>126911
Aho, Weinberger, Kernighan.

Yes, that Kernighan.
Thread replies: 11
Thread images: 1

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK