Question

How to search a string using a basic regular expression in Vi editor? How about using...

How to search a string using a basic regular expression in Vi editor? How about using extended regular expression in Vi editor?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Using Basic Regular Expression

If you want to search a string starting with "no" and ending with "on"

Press / to search string one by one

and then regular expression no.*on

where . denotes any character but not end of line(EOL)

and * denotes repetition on previously occured characters

Press enter to mve cursor to the found string

Press n to find next occurence.

OUTPUT:

Using Extended Regular Expression

Use :set to enable use of extended regular expression in vi editor

This can be used as extended regular expression

:%s/v([0-9])/

0-9 is used to find numbers in expression

v is used so that there is no need to write ( or ) and simple ( or ) and be typed

Add a comment
Know the answer?
Add Answer to:
How to search a string using a basic regular expression in Vi editor? How about using...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Regular Expression. 1. Write the regular expression that matches any string that ends with a...

    Using Regular Expression. 1. Write the regular expression that matches any string that ends with a capital letter. 2. Write the regular expression that matches any string that begins with a digit, ends with a digit, and has AT MOST only one digit in the middle of the string. (* means zero or more of preceding, +means one or more and ? means 0 or 1 (we did not look at the ? in class)) So your answer should match...

  • Part II: Regular Expression 1. Chose match(es) for each given basic/extended regular expression (maybe multiple correct...

    Part II: Regular Expression 1. Chose match(es) for each given basic/extended regular expression (maybe multiple correct matches) and describe the pattern of matched string for 3), 4), 5),6), 11) e.g. (ab+a, (extended regex ) a) ababa b) aba c)abba d)aabba e)aa Answer: b,c; Pattern : The matched string should begin and end with 'a and ‘b' occurs at least once between leading and ending ‘a') ote: 1) to 5)are basic regexes 1) 'a[ab]*a' (a)ababa (b) aaba (c) aabab (d) aabbaa...

  • 5. Describe informally the kind of pattern that matches the following extended regular expression: [b-d]a?e+ and...

    5. Describe informally the kind of pattern that matches the following extended regular expression: [b-d]a?e+ and rewrite it using only the basic (not extended) features of formal regular expressions. [For example, character classes [.1 positive closures +, and optionals? are not basic features, and should be expressed using only the basic taxonomy instead]. [4 marks 6. Explain the assertion that " there is more to taking Compiler Construction course than solely at writing a typical compiler" aiming [3 marks 5....

  • Using your vi(m) editor, answer the following questions and email it to your instructor. Note that...

    Using your vi(m) editor, answer the following questions and email it to your instructor. Note that I am not looking for perfect answers. This activity if to practice vi(m). Good practice site http://vimgenius.com/ On the top of all your documents, always include these items: your name: date: Answers for week 3 What are the names of the parts of a UNIX command? List them, and give a brief description of each. Can multiple UNIX commands be typed on the same...

  • 5. Describe informally the kind of pattern that matches the following extended regular expression: [b-d]a?e+ and...

    5. Describe informally the kind of pattern that matches the following extended regular expression: [b-d]a?e+ and rewrite it using only the basic (not extended) features of formal regular expressions. [For example, character classes [.1 positive closures +, and optionals? are not basic features, and should be expressed using only the basic taxonomy instead]. [4 marks 6. Explain the assertion that " there is more to taking Compiler Construction course than solely at writing a typical compiler" aiming [3 marks

  • Basic compiler question: Construct a regular expression for the regular language representing the set of strings...

    Basic compiler question: Construct a regular expression for the regular language representing the set of strings where the number of b’s is a multiple of 3 and there can be any number of a’s. The alphabet is {a,b}

  • Hi, What is in your opinion in this message related to Vi Text Editor? I have...

    Hi, What is in your opinion in this message related to Vi Text Editor? I have never used a vi text editor before. I have always used word processors like Microsoft Word or notepad. It was very interesting to learn the basics of a text editor and learn that you can make a file right from that by using a couple of commands. I believe I would be able to use the text editor in the work field but I...

  • I. Write a regular expression that matches a string of bits only if: it starts with...

    I. Write a regular expression that matches a string of bits only if: it starts with a '0', ends with a '00', and has a '1' between every '010'.

  • Regular Expression processor in Java Overview: Create a Java program that will accept a regular expression...

    Regular Expression processor in Java Overview: Create a Java program that will accept a regular expression and a filename for a text file. The program will process the file, looking at every line to find matches for the regular expression and display them. Regular Expression Format The following operators are required to be accepted: + - one or more of the following character (no groups) * - zero or more of the following character (no groups) [] – no negation,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT