Skip to main content
added 112 characters in body
Source Link
Florent
  • 2.6k
  • 15
  • 16

JavaScript, 3838 36 bytes

f=s=>s=>/(\D+)(\d+)(.+)/.exec(s).slice(1)

Example

Example:

const f =

s=>/(\D+)(\d+)(.+)/.exec(s).slice(1)

console.log(f("UK7898S14"));
console.log(f("cphDK1234CYELLOWS14QGOOD"));
f("UK7898S14")
// ["UK", "7898", "S14"]

f("cphDK1234CYELLOWS14QGOOD")
// ["cphDK", "1234", "CYELLOWS14QGOOD"]
 

JavaScript, 38 bytes

f=s=>/(\D+)(\d+)(.+)/.exec(s).slice(1)

Example:

f("UK7898S14")
// ["UK", "7898", "S14"]

f("cphDK1234CYELLOWS14QGOOD")
// ["cphDK", "1234", "CYELLOWS14QGOOD"]

JavaScript, 38 36 bytes

s=>/(\D+)(\d+)(.+)/.exec(s).slice(1)

Example

const f =

s=>/(\D+)(\d+)(.+)/.exec(s).slice(1)

console.log(f("UK7898S14"));
console.log(f("cphDK1234CYELLOWS14QGOOD"));
 

edited body
Source Link
Florent
  • 2.6k
  • 15
  • 16

JavaScript, 3638 bytes

f=s=>/(\D+)(\d+)(.+)/.exec(s).slice(1)

Example:

f("UK7898S14")
// ["UK", "7898", "S14"]

f("cphDK1234CYELLOWS14QGOOD")
// ["cphDK", "1234", "CYELLOWS14QGOOD"]

JavaScript, 36 bytes

f=s=>/(\D+)(\d+)(.+)/.exec(s).slice(1)

Example:

f("UK7898S14")
// ["UK", "7898", "S14"]

f("cphDK1234CYELLOWS14QGOOD")
// ["cphDK", "1234", "CYELLOWS14QGOOD"]

JavaScript, 38 bytes

f=s=>/(\D+)(\d+)(.+)/.exec(s).slice(1)

Example:

f("UK7898S14")
// ["UK", "7898", "S14"]

f("cphDK1234CYELLOWS14QGOOD")
// ["cphDK", "1234", "CYELLOWS14QGOOD"]
Source Link
Florent
  • 2.6k
  • 15
  • 16

JavaScript, 36 bytes

f=s=>/(\D+)(\d+)(.+)/.exec(s).slice(1)

Example:

f("UK7898S14")
// ["UK", "7898", "S14"]

f("cphDK1234CYELLOWS14QGOOD")
// ["cphDK", "1234", "CYELLOWS14QGOOD"]