Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
14 votes
6 answers
1k views

How to extract the last digits of strings using regular expressions?

I have a bunch of colnames L_1_3 L_2_23 L_3_91 L_3_16 I want to replace these colnames with new names using the last digits following the _ like this: 3 23 91 16 I've tried colnames(X) <- gsub(...
Drew 's user avatar
  • 583
1 vote
1 answer
1k views

RegEx to Remove Middle Initial in a Full Name

Names for Example: note there is no spaces. JohnJSmith MikeLJohnson PeterWWalker result should be: JohnSmith MikeJohnson PeterWalker [A-Z]{2} RegEx matches only two cap letters, not sure how ...
PaulP's user avatar
  • 47
0 votes
3 answers
55 views

Return a string between two characters '.'

I have column names similar to the following names(df_woe) # [1] "A_FLAG" "woe.ABCD.binned" "woe.EFGHIJ.binned" ... I would like to rename the columns by removing the "woe." and ".binned" ...
Natalie King's user avatar
0 votes
1 answer
2k views

Split column names in R [duplicate]

I have a data frame like below. df: X1.Name X1.ID X1.Prac X1.SCD But, I need to split the column name by dot and display as, output df: Name ID Prac SCD
DinuJ's user avatar
  • 81
0 votes
1 answer
110 views

MySQL add period to name initials if no period exists

I have a dataset like this: Juan Corona Jane L Doe John Q. Public R S Fitzgerald I need to clean this up so it's: Juan Corona Jane L. Doe John Q. Public R. S. Fitzgerald But since MySQL doesn't ...
Slam's user avatar
  • 3,325
4 votes
4 answers
2k views

python regular expressions - how to get all the names in a line?

How do i get the names from the line like below, using regex ?? line #1==> Elector's Name: Surpam Badurubai Elector's Name: Madavimaru Elector's Name: Madavitannubai line #2==> Elector's ...
Bharath Varma's user avatar
4 votes
1 answer
2k views

Validate Title Case Full Name with Regex

To learn Regex, I was solving some problems to train and study. And this is the problem, i know it might not be the best way to do with Regex, and my Regex is a mess, but i liked the challenge. ...
danieltakeshi's user avatar
2 votes
3 answers
1k views

preg_match first/last name matching groups

I'm using this PHP regexp to check true/false whether a field contains a name, consisting of at least a first/last name, and then optional other middle names or initials. $success = preg_match("/([\x{...
Jonny Nott's user avatar
0 votes
1 answer
3k views

Check if name is valid with Proper case and Max one space

I searched for all regex exp but didn't find any matching my needs. Regular expression to allow spaces between words Regular expression to allow alphanumeric, max one space etc Regex, every non-...
Sujay U N's user avatar
  • 5,342
0 votes
2 answers
49 views

JavaScript Using RegEx to Parse LastName

I've seen lots of posts that are -almost- what I need and I've managed to get -almost- the answer I need, but I could use a little help getting the final bit. I think I'm getting confused between when ...
A.W.'s user avatar
  • 5
5 votes
3 answers
5k views

Using RegEx for validating First and Last names in Java

I am trying to validate a String which contains the first & last name of a person. The acceptable formats of the names are as follows. Bruce Schneier Schneier, Bruce Schneier, ...
Kemat Rochi's user avatar
1 vote
2 answers
136 views

Formatting Character strings (First and Last Names) in a long character vector in R

I have many names of people in my character vector: MLB$Names[1:4] [1] "Derek Jeter" "Robinson Cano" "Nick Markakis" "David Ortiz" I would like to format them to contain the first inital, ...
IRNotSmart's user avatar
1 vote
1 answer
213 views

Validate Proper Names (with Perl)

I have a census list of 150k last names, and trying to use this to validate the spelling of person names in an existing database. Obviously there are many ethnic names in my database that don't match ...
La Bomba's user avatar
2 votes
3 answers
1k views

Regular Expression to Extract Surnames With Prefixes

Is there a way I can extract parts of a name from a string, using regular expression or other logic. I would like to split names by spaces, but in the case that a name is prefixed, I would like to ...
Kohjah Breese's user avatar
0 votes
2 answers
275 views

Rownames with parentheses: are they allowed in R?

I am trying to subset data, using names of work and test set ws_data <- subset(data, grepl(paste0("v*[0-9]_",ws_names, collapse="|" ), rownames(data))==TRUE) It seems to work ok, but ...
Boddha's user avatar
  • 177
4 votes
2 answers
9k views

Invalid character range error in a new function [duplicate]

I have a problem with the follwoing error message invalid regular expression '([a-Z]*)_(.*)', reason 'Invalid character range' so the line of code which causes the error is if(tide=="long") ...
Tim Heinert's user avatar
1 vote
3 answers
478 views

Regular Expression match everything but two names and <email address> after particular word

I have a bunch of Names and email addresses inside of these aggregated emails and I'd like to get rid of everything but the First Last <[email protected]> throughout the document. Basically I ...
mochabcha's user avatar
  • 286
2 votes
1 answer
6k views

Sort a cell array of strings alphabetically by last name

In Matlab, I have a cell array like: names = { 'John Doe', 'Jane Watkins', 'Jeremy Jason Taylor', 'Roger Adrian' } I would like to sort these such that the last names appear in ...
Superbest's user avatar
  • 26.6k
0 votes
1 answer
117 views

Modifications to a reg-ex compilation

I have the following Regex used to match PHP Class, method and Function names to validate them, it was originally taken from PHP's site (Linked Below) The problem is that it does not match single ...
RobertPitt's user avatar
  • 57.3k
1 vote
6 answers
2k views

How can I extract the columns of data with Perl?

I have strings of this kind NAME1 NAME2 DEPTNAME POSITION JONH MILLER ROBERT JIM CS ASST GENERAL MANAGER I want the output to be name1 ...
Sunny's user avatar
  • 175
14 votes
4 answers
31k views

PHP Regex for human names

I've run into a bit of a problem with a Regex I'm using for humans names. $rexName = '/^[a-z' -]$/i'; Suppose a user with the name Jürgen wishes to register? Or Böb? That's pretty commonplace in ...
KdgDev's user avatar
  • 14.5k