Search and replace regular expression in Open Office calc
Asked Answered
D

1

5

I've got something like this (in Open Office Calc):

Streetname. Number
Streetname. Number a

etc. Now I want to delete everything in front of the number. So I need to do a search and replace I guess. ^.*?([0-9]) this one matches Streetname. Number .. but what should I put in the replace field? If I do the search and replace, it deletes everything within the datafield :(

Doggish answered 31/7, 2010 at 7:43 Comment(0)
D
10

In Search for field, write the following regex: (.*?[:space:])([0-9]+)

And in Replace with, write: $2

That means that you search for:

  1. any characters followed by a space
  2. one or more digits.

Replace all that with $2 - the reference to the digits.

It will replace Streetname. Number 24 with 24. Why did you put a in your example?

Discant answered 31/7, 2010 at 8:6 Comment(2)
Yes, great .. $2 and the regex worked :) Thank you very muchDoggish
Oh .. yes .. didn't seem that obvious :-SDoggish

© 2022 - 2024 — McMap. All rights reserved.