Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

replace(/\s|:/gm, "") wtheck

Name: Anonymous 2011-11-03 22:47

I was translating a flash object into a C++ object and I ran into this..

public static function toArray(param1:String) : ByteArray
{
    param1 = param1.replace(/\s|:/gm, "");

What in the world is "/\s|:/gm"? can anyone give me an explanation or link to some documentation?

Name: Anonymous 2011-11-03 22:56

regex

Name: Anonymous 2011-11-03 22:58

It's a regular expression. It searches for all space-class characters followed by '|' followed by ':' matching globally (g) and multi-line (m). It scans a string and removes the sequence of three characters at any point in the string where strlen(s) >= 3 && isspace(s[0]) && s[1] == '|' && s[2] == ':' (C code) is true.

Name: op 2011-11-03 23:15

holy crap, I actually got an answer. Thanks a lot :D

++ internets for you

Name: Anonymous 2011-11-04 2:13

>>3
followed by |
| is or. It removes any whitespace or semicolons from the string.

Name: Anonymous 2011-11-04 2:42

>>2,3,5
What is wrong with you?
>>4
Get the fuck out.

Name: Anonymous 2011-11-04 6:44

>>6
We want to see a change in /prog/ so we become the change. Besides, >>1 knows how to write properly and seems to know what he's doing and only needs a little nudge in the right direction.

Don't change these.
Name: Email:
Entire Thread Thread List