What are regular expressions?

Showing Answers 1 - 2 of 2 Answers

Sunil Kartikey

  • Sep 18th, 2006
 

a code line that defines a pattern for a search to match

  Was this answer useful?  Yes

prabhath_01

  • May 31st, 2008
 

Regular Expresiions is the heart of Perl language.

Using this we can search and raplace with partcular pattern in a given text.
We can read a file and replace all occurances of some word or pattern with some other.

Eg: In a given text you want to replace some word with some other.
(Suppose you want to replace all occurances of 'Perl' with 'PERL')

$text = "Perl is awesome and Perl is wonderful language and Perl is very simple";

print "n Text before:", $text;

$text =~ s/Perl/PERL/g;

print "n Text after :", $text;


o/p:  PERL is awesome and PERL is wonderful language and PERL is very simple

Advantages:
#########

1) You can read a file and replace all occurenaces easily
2) It saves a lot of time if u do that steps manually so there by it saves lot of time

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions