Ticket #19339

Stringクラスのmatchメソッドが動作しない

Open Date: 2009-10-25 22:06 Last Update: 2009-10-28 19:53

Reporter:
Owner:
(None)
Type:
Status:
Closed
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
None

Details

kbook70ページの例が動作しません。

>>> String str = "1 + 2 = 3";
>>> str.match(/\d/);
[]

>>> String url = "http://www.website.org/konoha";
>>> url.match(/(\w+):\/\/([\w.]+)\/(\S*)/);
[]

また、regexでエラーが起きるとsegmentation faultで落ちてしまいます。

>>> $konoha.regex
"POSIX.2"
>>> String str = "1 + 2 = 3";
>>> str.match(/+/);
[konoha] regex(error): Invalid preceding regular expression
zsh: segmentation fault  konoha

Ticket History (2/2 Histories)

2009-10-25 22:06 Updated by: ryotah
  • New Ticket "Stringクラスのmatchメソッドが動作しない" created
2009-10-28 19:53 Updated by: imasahiro
  • Component Update from (None) to konoha0.7 メインライン
  • Resolution Update from None to Fixed
  • Status Update from Open to Closed
  • Ticket Close date is changed to 2009-10-28 19:53
  • Milestone Update from (None) to 0.7 正式リリース (closed)
Comment

修正しました

>>> "1 + 2 = 3".match(/+/)
[konoha] regex(error): repetition-operator operand invalid
[]
>>> "1 + 2 = 3".match(/\+/)
["+"]
>>> String str = "1 + 2 = 3";
>>> str.match(/\d/);
[]

>>> String url = "http://www.website.org/konoha";
>>> url.match(/(\w+):\/\/([\w.]+)\/(\S*)/);
[]

こちらは元々POSIXの正規表現では動作しない正規表現です

Attachment File List

No attachments

Edit

Please login to add comment to this ticket » Login