Question

write a regular expression in python (nltk) that will find strings using integers, additon, and multiplication,...

write a regular expression in python (nltk) that will find strings using integers, additon, and multiplication, such as 5*5+8.

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

Regular expression:-

(\d+(*|/|+|-))+

Explanation:-

The above regular expression is used to perform one or more operations between the digits.

\d indicates the digit from 0-9 which is followed by the + .It means that the size of the number obtained by the digits from 0-9 can be 1 or more than 1.

(*|/|+|-) indicates the four arithmetic operations i.e, multiplication , division , addition , subtraction. It contain | symbol indicating the OR operation which mean that either of the 4 operations is chosen at a time.

+ (at the end) clearly indicates that one or more operations between one or more digits.

Add a comment
Know the answer?
Add Answer to:
write a regular expression in python (nltk) that will find strings using integers, additon, and multiplication,...
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
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
ADVERTISEMENT