[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
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

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

banner
banner
[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.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.