エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
[py2rb] re.finditer - Qiita
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
[py2rb] re.finditer - Qiita
import re text = "He was carefully disguised but captured quickly by police." for m in re.findite... import re text = "He was carefully disguised but captured quickly by police." for m in re.finditer(r"\w+ly", text): print('%02d-%02d: %s' % (m.start(), m.end(), m.group(0))) # 07-16: carefully # 40-47: quickly text = "He was carefully disguised but captured quickly by police." puts text.scan(/\w+ly/).map{ "#{text.index(_1).to_s.rjust(2, '0')}-#{(text.index(_1) + _1.size).to_s.rjust(2, '0')}: #{_1}