0

In VI I need to replace a pattern that looks like this:

seq- followed by exactly 24 chars (can be 0-9, a-z, A-Z only) followed by / followed by some number of (0-9, a-z, A-Z). So an example string would be:

seq-BzFk78qrJBkbnv1KkxppsfG4/92191_A_B

I want to replace the above string with a fixed string:

seq-ID/NUM_ID

How do I do this in Vi or Vim? I tried a few things like

  :%s/seq-[a-zA-Z0-9]{24}/[a-zA-Z0-9]{+}/seq-ID/NUM_ID

But it doesnt' work..

1

1 Answer 1

1

You have to be careful with how you use quantifier and you must escape the /. Try this

:%s/^seq-[a-zA-Z0-9]\{24\}\/.*$/seq-ID\/NUM_ID/
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.