Creating Usernames

A swapping-ground for Regular Expression syntax

Creating Usernames

Postby gilessmith » Mon Nov 27, 2017 2:52 pm

Hi

i'm having trouble selecting parts of a filename but leaving other bits behind..... :/

i have 1stname and surname, i'd like to keep 1st initial and remove the rest of the 1st name and the space, so that giles smith becomes gsmith

i did have this but it doesn't seem to work, any ideas :)

match :: ^([A-Z])([a-z]*) ([A-Z][a-z]*)
replace :: \1\3

many thanks

giles
gilessmith
 
Posts: 2
Joined: Mon Nov 27, 2017 2:44 pm

Re: Creating Usernames

Postby gilessmith » Mon Nov 27, 2017 3:44 pm

SOLVED - found it in my own wiki :roll:

regex :: ^(.).+ (.+)$
replace :: \1\2
gilessmith
 
Posts: 2
Joined: Mon Nov 27, 2017 2:44 pm


Return to Regular Expressions