Find URI in text: Difference between revisions

Content added Content deleted
Line 210: Line 210:
leading junk ftp://domain.name/dangling_close_paren)
leading junk ftp://domain.name/dangling_close_paren)
EOF
EOF

say $/;
say "We matched $/, which is a $/.^name() at position $/.from() to $/.to()"
</lang>
</lang>


Line 223: Line 226:
ftp://domain.name/path(unbalanced_brackets/ending.in.dot.
ftp://domain.name/path(unbalanced_brackets/ending.in.dot.
ftp://domain.name/path/embedded
ftp://domain.name/path/embedded
ftp://domain.name/dangling_close_paren)</pre>
ftp://domain.name/dangling_close_paren)
「ftp://domain.name/dangling_close_paren)」
IETF::RFC_Grammar::URI::absolute_URI => 「ftp://domain.name/dangling_close_paren)」
scheme => 「ftp」
We matched ftp://domain.name/dangling_close_paren), which is a Match, at position 554 to 593</pre>

That last lines shows that we get back Match objects, that we can query to get all kinds of information.
We even the information was subrules matched, and since these are also Match objects we can also obtain
their match position in the text.


=={{header|Pike}}==
=={{header|Pike}}==