0

Is regular expression syntax symbol are same in every language or any change. I am learning ruby and rails and I am reading this book http://www.railstutorial.org/book/

In this book writer use regular expression and i want to know is it different in ruby or rails or same like other languages ?

Please help me

3 Answers 3

2

Ruby's regular expressions function in much the same way as Perl. Some special notes:

In Ruby, the caret and dollar always match before and after newlines. Ruby does not have a modifier to change this. Use \A and \Z to match at the start or the end of the string.

Much like JavaScript, you can create a Regexp object with literal notation:

myRegExp = /test/i

Ruby's implementation mostly differs in the methods and operators available on Regexp objects.

More information about Ruby's implementation of regular expressions is available here.

Sign up to request clarification or add additional context in comments.

Comments

0

The fundamentals are the same but there can be discrepancies between languages. Here's a good site for ruby regex http://rubular.com/

Comments

0

It really depends on the regular expression engines adopted by a programming language. They all should comply with the POSIX standards or some other specific extensions. So basically, they are pretty much of the same.

Ruby(1.9) supports GNU regex, POSIX and Oniguruma native. For details difference between lanagues, search Comparison_of_regular_expression_engines#Language_features on wikipedia.

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.