Re: C# programmer wants to learn assembly?? plz help




David Jones wrote:
Dragontamer <prtiglao@xxxxxxxxx> wrote...

David Jones wrote:
[snip code]
ECMAscript?? Ewww... Go Perl :-)

Yeah, Perl would be a better example, but IIRC the regex syntax is
different, and I only know ECMAScript regex syntax.

All regex is based on grep somewhat. They are all very similar.
Though... if ECMAscript has grouping and all that, they must
be virtually identical.

I have no clue about ECMA, but I'm almost certain that Perl can
make any challenge you throw at it. Especially with its massive
library.

Perl + ImageMagick API and ~50 lines of code can do things that
whole applications cannot do to pictures without significant
effort/plugins for example.

if(string =~ m/\(?\d{3}\)?\s*\d{3}(-|.)?\d{4}/ )

There, and no nasty || statements making the example
excessivly long.

The reason for the || is to break it up so that you don't have lots of |
in the expression. Your version wouldn't work since it would also
match:

(202 555.1212

And doesn't match:

202/555-1212

Toche. For the latter example, I shall do d{3}[\)\/]? and that fixes
it :-)

For the earlier example, meh, I give up. Use your stupid ||
statements. :-p

Took about 1 minute but no test yet; cause I suck with Perl
and don't feel like compile-checking :-p

Does ECMAscript have grouping? In Perl you can just
do \d{3}(-|.)?\d{3} and that will match each of the following:

Yes, I used it in the other example.... :)

You did? Where? :-p

--Dragontamer

.



Relevant Pages

  • Re: C# programmer wants to learn assembly?? plz help
    ... address in a string has the format something@xxxxxxxxxxx? ... the code above while I was typing my reply, the ECMAScript version ... Yeah, Perl would be a better example, but IIRC the regex syntax is ...
    (alt.lang.asm)
  • Re: C# programmer wants to learn assembly?? plz help
    ... David Jones wrote: ... Yeah, Perl would be a better example, but IIRC the regex syntax is ... and I only know ECMAScript regex syntax. ...
    (alt.lang.asm)
  • Re: C# programmer wants to learn assembly?? plz help
    ... address in a string has the format something@xxxxxxxxxxx? ... the code above while I was typing my reply, the ECMAScript version ... Write the validation in assembly just ... Took about 1 minute but no test yet; cause I suck with Perl ...
    (alt.lang.asm)
  • Re: "unwrappen" eines HTML-Blocks
    ... Perl verwendet ... (ECMAScript Ed. 4 wird möglicherweise mehrzeilige RegExp-Literale ... Rand des linken Bildschirms die Mitte des Desktops. ...
    (de.comp.lang.javascript)
  • Re: "unwrappen" eines HTML-Blocks
    ... diesbezüglich dieselbe Syntax wie ECMAScript. ... Üblicherweise verwendet man aber die Schrägstriche, weil dadurch ein regulärer Ausdruck besser als solcher erkennbar ist. ... den RegExp-Konstruktor, dem ein string-Wert übergeben werden kann sowie die ... Perl kennt ebenfalls einen solchen Konstruktor. ...
    (de.comp.lang.javascript)