cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
392
Views
0
Helpful
3
Replies

How does this translation rule break down?

shikamarunara
Level 4
Level 4

In this rule;

rule 1 /\(.*\)/ /3000/

I'm having trouble understanding the syntax for

\(.*\)

I've looked at the documentation which explains that "\" slices up the number (whatever that means). The parenthesis indicate which matched numbers to keep, but what does it mean when we're saying that we want to keep ".*\" ? How does the last character of "\" work, why does it need to be there?

-Shikamaru

3 Replies 3

paolo bevilacqua
Hall of Fame
Hall of Fame

Hi,

slice means "cut the number in sets", the ones that are in parenthesis are saved, others are not. The ones saved can be recalled in the in replaced part, however your example does not do that. What your example does is to prepend 3000 to any number, an can be rewritten more concisely as:

rule 1 // /3000/

The backlashes are simply need to quote parenthesis.

Thanks, p.

-Shikamaru

No, actually, this doesn't work. When you try to use two forward slashes in succession, IOS kicks it back as having ammended the digits, not replaced.

-Shikamaru