Author Topic: Javascript Problems  (Read 6869 times)

0 Members and 1 Guest are viewing this topic.

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: Javascript Problems
« Reply #15 on: April 17, 2011, 05:41:49 am »
You can do [\r\n]+ to capture one or more linebreak characters in a row.
There's something about Tuesday...


Pushpins 'n' stuff...


Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Javascript Problems
« Reply #16 on: April 17, 2011, 05:43:00 am »
Code: [Select]
inputText = inputText.replace(/[^A-Fa-f0-9]+/g,'').replace(/\s/g,'').replace(/\n|\r|\s/g,'').toUpperCase()
That was my original code yeah, but I have shortened it now.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Javascript Problems
« Reply #17 on: April 17, 2011, 02:13:08 pm »
\s captures all linebreaks, tabs, spaces, etc. It's the same as [\r\n \t ... ].

I didn't know that! I just thought it represented a space.
Thanks for the info :)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Javascript Problems
« Reply #18 on: April 18, 2011, 09:23:39 am »
Whitespace includes anything that's blank and a space :D