How i can construct regexp, which will always matches nothing?
For example:
"xxxxxxx".match /my_special_regexp/
=> should be ALWAYS nil
···
--
Posted via http://www.ruby-forum.com/.
How i can construct regexp, which will always matches nothing?
For example:
"xxxxxxx".match /my_special_regexp/
=> should be ALWAYS nil
--
Posted via http://www.ruby-forum.com/.
Joao Silva wrote:
How i can construct regexp, which will always matches nothing?
For example:
"xxxxxxx".match /my_special_regexp/
=> should be ALWAYS nil
How about:
re = /$a^/
--
Posted via http://www.ruby-forum.com/\.
Why do you want to have a such regex ?
Anyway, it seems that /^$a/ will never match with any string.
"a".match /^$a/
=> nil
"".match /^$a/
=> nil
"a ".match /^$a/
=> nil
--
Posted via http://www.ruby-forum.com/.
Joao Silva wrote:
How i can construct regexp, which will always matches nothing?
For example:
"xxxxxxx".match /my_special_regexp/
=> should be ALWAYS nil
not sure, but something that should always be nil .... what about the constant 'nil' ![]()
Joao Silva wrote:
How i can construct regexp, which will always matches nothing?
For example:
"xxxxxxx".match /my_special_regexp/
=> should be ALWAYS nil
Just out of curiosity: Why do you use a method call, when you expect a constant?
7stud -- wrote:
Joao Silva wrote:
How i can construct regexp, which will always matches nothing?
For example:
"xxxxxxx".match /my_special_regexp/
=> should be ALWAYS nilHow about:
re = /$a^/
I guess that could be made even simpler:
re = /a^/
--
Posted via http://www.ruby-forum.com/\.
7stud -- wrote:
7stud -- wrote:
Joao Silva wrote:
How i can construct regexp, which will always matches nothing?
For example:
"xxxxxxx".match /my_special_regexp/
=> should be ALWAYS nilHow about:
re = /$a^/
I guess that could be made even simpler:
re = /a^/
..and probably more efficient:
re = /a\A/
--
Posted via http://www.ruby-forum.com/\.