Ask Your Question

Find and Replace any characters before a comma [closed]

asked 2013-12-27 22:52:10 +0200

Dsarnowski gravatar image

updated 2015-11-16 18:48:01 +0200

Alex Kemp gravatar image

I have LibreOffice 4.1 on my Mac OS X laptop. I am using spreadsheet and have a column that includes names formatted like this: first, last.

I would like to run find and replace so I can remove anything before and including the comma and space so I am just left with the last name. I used to do this in Excel and it worked well:

Find and Replace, select column, enter this in find "*, ", leave replace blank.

I cannot for the life of me figure out how to do this with regular expressions. Anyone know how I can do this?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-11-16 18:48:15.453449

2 Answers

Sort by » oldest newest most voted

answered 2013-12-29 15:36:23 +0200

L-user gravatar image

updated 2013-12-29 15:38:29 +0200

  1. Edit | Find and Replace.
  2. Search for type in:
    Note: Last character is space.
  3. Leave "Replace with" input box empty.
  4. Click on "Other Options" and make sure "Regular expressions" is checked.
  5. Click Replace button (or Replace All it depends what you would like to do).

Detailed help for regular expressions used in LibreOffice:

In you case:
^ Match at the beginning of a line.
. Match any character.
* Match 0 or more times. Match as many times as possible.
, Comma and space not a special characters, but must be included in find & replace.

edit flag offensive delete link more

answered 2013-12-28 12:59:43 +0200

JohnSUN gravatar image

Just add dot to search string - ".*, " and check that Regular expresion is On

Or use Data-Text to column by comma and space

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-12-27 22:52:10 +0200

Seen: 9,728 times

Last updated: Dec 29 '13