Replace content between string that contains a specific word
-
@PeterJones
i cant make it with the plugin also, and my line is like},{\ "host\ ":\ "ok\ ",\ "type\ ":\ "sub\ ",\ "url\ ":\ "https:// ok. ru/videoembed/7335889799713\ "},{
without the spaces
thank you, ill try to find another way or tools if i cant here
-
I’m the JsonTools maintainer.
Pretty sure that with JsonTools, if you have an array of objects, and you want to select only those objects where theurl
field containsok.ru
, you can just run the query@[@[:].url =~ `ok\.ru`]
.
I don’t have a computer handy, so I can’t be of more than limited assistance. -
or at least is there an way to find all sentence like:
{\ "host\ ":\ "ok\ ",\ "type\ ":\ "sub\ ",\ "url\ ":\ "https:// ok. ru/videoembed/7335889799713\ "},
i try {\ "host\ ":\ "ok\ ",\ "type\ ":\ "sub\ ",\ "url\ ":\ "https:// ok. ru/videoembed/([0-9]*)\ "}, but is not working also
-
Please, please read Formatting Forum Posts, as I linked to you before. Your example data and regexes are not coming across as I believe you intend, which makes your questions/replies essentially unintelligible.
On your first post, I could guess what you intended. But the last few have been indecipherable to me. As such, I cannot help you anymore, and anyone else who tries will just be guessing what you actually meant.
-
@PeterJones im asking the same thing, but if i cant get the sentence between {…} at least i want to find and replace something like {\ "host\ ":\ "ok\ ",\ "type\ ":\ "sub\ ",\ "url\ ":\ "https:// ok. ru/videoembed/random number\ "} and the problem is the \ (slash) when i try to use expressions
-
im asking the same thing
I cannot believe your text has all the backslashes that we see in your post:
Does your text really have all those backslashes? Because your original post did not have all those backslashes, but your followon text does. If your real text does not, then read the FAQ on how to format your question. If you want an answer, format your text so that it acurately reflects the text you have. We cannot help you if you don’t share the text you actually have.
-
@PeterJones yes it has all the backslashes, in the first post it didn’t had cuz the editor here hide it, and i saw it after i post, and i have to add space after every backslashes so you can see it
-
So there are really backslashes but not spaces? That means your post is still not showing the actual data? All you have to do to show us the real data is to hit the
</>
button on your post’s toolbar and paste the data in between. It’s really quite simple to do, and reading the FAQ would have shown you how days ago.We still cannot help you until you show your actual data.
-
{\"host\":\"ok\",\"type\":\"sub\",\"url\":\"https://ok.ru/videoembed/7335889799713\"}
this is it
-
So if I’ve understood correctly, the text here has two copies of what you don’t want and two copies that would be okay to keep
{\"host\":\"ok\",\"type\":\"sub\",\"url\":\"https://something.else/videoembed/7335889799713\"},{\"host\":\"ok\",\"type\":\"sub\",\"url\":\"https://ok.ru/videoembed/7335889799713\"},{\"host\":\"ok\",\"type\":\"sub\",\"url\":\"https://something.else/videoembed/7335889799713\"},{\"host\":\"ok\",\"type\":\"sub\",\"url\":\"https://ok.ru/videoembed/7335889799713\"}
If you want to turn the
ok.ru
versions into just{}
, then just
FIND ={[^}]*ok\.ru[^}]*}
REPLACE ={}
That will find any
{...}
that has the literalok.ru
in it, and turn it into just{}
, and it shouldn’t ever grab too much. It will end up with{\"host\":\"ok\",\"type\":\"sub\",\"url\":\"https://something.else/videoembed/7335889799713\"},{},{\"host\":\"ok\",\"type\":\"sub\",\"url\":\"https://something.else/videoembed/7335889799713\"},{}
If your data is ever much different from the example you showed, I make no guarantees.
Good luck.
-
@PeterJones it is working good, thank you much