Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript first and last name on fullname regex

var rex = /^((w*)s?).*?(s?(w*)[^ws]*)$/
var v = ["Luis Caldas Neto", "Luis Neto!", "Luis Neto", "Luis G Neto", "Luis"]
// Running tests
JSON.stringify( 
  v.map( v => rex.exec(v.trim()).filter((x, i, a)=>(i===2||i===4))) 
)
// Tests sould be return values:
// ["Luis","Neto"],["Luis","Neto"],["Luis","Neto"],["Luis","Neto"],["Luis",""]

Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript function with input value 
Javascript :: row append and calculation in jquery datatable 
Javascript :: buttons js before submit 
Javascript :: find the second largest number in array javascript 
Javascript :: angular conditional tooltip 
Javascript :: signalr 
Javascript :: change one element in array javascript 
Javascript :: even numbers in an array 
Javascript :: how to see javascript code in chrome 
Javascript :: luhn algorithm javascript 
Javascript :: Create a Simple Delay Using setTimeout 
Javascript :: is javascript loosely typed 
Javascript :: fetch log api response time 
Javascript :: activate router angular 
Javascript :: call function add parameter javascript 
Javascript :: scraping google nodejs 
Javascript :: what i sminify javascript 
Javascript :: terading gyms for machhine learning 
Python :: django EMAIL_BACKEND console 
Python :: load pandas from text 
Python :: python count files directory 
Python :: make jupyter notebook wider 
Python :: how to return PIL image from opencv 
Python :: jupyter notebook reload module 
Python :: pandas version check in python 
Python :: pandas get rows string in column 
Python :: sort tuple by first element python 
Python :: pandas convert float to int 
Python :: python upload video to youtube 
Python :: python remove non letters from string 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =