you are not signed in | sign in or register
User Roger Poon - Stack Overflow
most recent 30 from
Feed & Web Facts
Feed Item Count
22 Oct 16 07:07
Last Reading
RSS/XML Version
Feed Language
Feed Encoding
LNG_QR_FAILED: connection to failed (errno=111, msg=Connection refused).
Related Feeds
You could also like to visit these feeds:
    Weekly People
    User Roger Poon - Stack Overflow
    Newest Posts in Feed
    Answer by Roger Poon for What is wrong in this code in js?
    You are attempting to add strings. You should convert to a number, but be careful with arbitrary user input. For example, none of the other answers will take into account the following inputs: "foo" "+Infinity" "-Infinity" Change this line: += itemCost; to: += itemCost >> 0;
    Answer by Roger Poon for How to comment a block containing regexp
    I know I'm late since a best answer has already been chosen, but since you were looking for a "clever trick, " I would suggest ending with an empty non-capturing group:/.*(?:)/which is equivalent to:/.*/It's the most convenient if you don't want to have to change any code. (e.g. via refactoring or as a side effect of introducing a capturing group.) It's also semantically the same (...
    Answer by Roger Poon for Split string into sentences in javascript
    str.replace(/([.?!])\s*(?=[A-Z])/g, "$1|").split("|")Output:[ 'This is a long string with some numbers [125.000, 55 and 140.000] and an end.', 'This is another sentence.' ]Breakdown:([.?!]) = Capture either . or ? or !\s* = Capture 0 or more whitespace characters following the previous token ([.?!]). This accounts for spaces following a punctuation mark which matches the English l...