Search for a multiple variable number
-
Hello,
I need help to search a multiple variable text in a lots of lines.
For example, I have this part who is always in the same format:/ xxx xxx xxx 255 /
/ xx x xxx 255 /Or something like this, and i want to replace this by
/ 238 46 231 255 /
How can I do ?
Thanks for your help
-
@Paul-Carfau said in Search for a multiple variable number:
/ xxx xxx xxx 255 /
/ xx x xxx 255 /
Or something like this, and i want to replace this by
/ 238 46 231 255 /(?=/.*255 /)(/.*255 /=?) -

-
I take it the
xin your example are digits and the empty space is really simply a single space character?If so, then then searching for
/\s\d{3}\s\d{3}\s\d{3}(?=\s255)and replacing with/ 238 46 231would work for your first example (set Regular expression mode).For your second example, do another replacement and tweak the first one slightly. Hint: Substitute different numbers inside the
{and}. -
@gurikbal-singh @Alan-Kilborn
I just realized by rereading my post that I forgot a precision. Your answers are correct, but my case is more complex because my lines are in this form:-38.2845993 41.9356995 -1.9463000 / 0.0000000 0.0000000 -1.0000000 / 0 0 0 255 / 0.0005000 0.4144570
-38.2499008 41.5647011 6.4520898 / 0.5073535 0.0000000 0.8617381 / 22 30 34 255 / 0.9995010 0.4144000and I wish to change this way :
-38.2845993 41.9356995 -1.9463000 / 0.0000000 0.0000000 -1.0000000 / 238 46 231 255 / 0.0005000 0.4144570
-38.2499008 41.5647011 6.4520898 / 0.5073535 0.0000000 0.8617381 / 238 46 231 255 / 0.9995010 0.4144000And I do not find a solution despite having spent time on the forums …
-
If the “precision” is just that the
x’s can be “up-to” three digits, then use @Alan-Kilborn’s solution slightly modified:\s\d{1,3}\s\d{1,3}\s\d{1,3}(?=\s255)Cheers.
-
Your my god, thanks a lot man !
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login