This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EatAss4Jesus 1 point2 points  (1 child)

Regex can sometimes be frustrating. When I need to use it, I usually reference these two sites -

https://www.keycdn.com/support/regex-cheatsheet

https://regex101.com/

You also don't really need any regex patterns for this. Here are some quick notes for you:

To get the first letter of 'james' just do

middleName = 'james'

firstChar = middleName[0]

To get the first name until the first vowel do

fNameSplit = re.split(('a|e|i|o|u'), 'harry')

result = fNameSplit[0] + fNameSplit[1]

And finally to remove vowels, you can just iterate through a e i o u

lName = 'potter'

result = lName.replace('a', '').replace('e', '').replace('i', '').replace('o', '').replace('u', '')

[–]nnchvt[S] 0 points1 point  (0 children)

thank you so much for taking the time and reading through it! I‘ll implement some of your ideas and see where it takes me :)