Regex to choose one random occurence of a keyword between a { and } sign -


my text example:

{this text example , keyword, keyword in text multiple times , want 1 of keyword replaced, should chosen randomly every time}

so out of 3 keywords want 1 replaced, chosen randomly. keyword appears more 3 times, once.
possible regex?

no, not possible regex.

you could, however, use regex find of keywords, generate random number, , use number replace 1 occurance.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -