http://qs1969.pair.com?node_id=11139539


in reply to Re^2: multiple-pass search?
in thread multiple-pass search?

Unfortunately you have not provided so much as a single line of Perl here. As such it is impossible to know at which point you are encountering a problem, let alone what that problem is.

Here is the sort of SSCCE you could have written:

use strict; use warnings; use Test::More tests => 3; my $filename = 'abstract-345.tex'; my $have = <<'EOT'; foo Here: \zerozerozero bar No. 345 baz EOT my $want = <<'EOT'; foo Here: \threefourfive bar No. 345 baz EOT my @digits = qw/zero one two three four five six seven eight nine/; my ($arabic) = $filename =~ /-([0-9]{3})\.tex/; (my $eng = $arabic) =~ s/([0-9])/$digits[$1]/g; $have =~ s/\\zerozerozero/\\$eng/; is $arabic, '345', 'Digits extracted'; is $eng, 'threefourfive', 'Converted to English'; is $have, $want, 'Replaced in text';

Now you can see how to perform these three operations. If that doesn't solve your problem you need to provide some runnable code which demonstrates the problem which you are having (ideally with a test such as shown here). In that way we will know what it is you are actually asking.

There's a detailed rationale at How to ask better questions using Test::More and sample data.


🦛