I'm new to the Regex world and I've browse many site without finding what I'm looking for. I have a file where I need to fetch the address. The address is align-left of the paper (there's text in the same line at the right).
Some information on multiple line (6)
that I don't need and can't paste because
it contains some personal information.
So imagine a lot of text here...
So imagine a lot of text here...
So imagine a lot of text here...
Sold To Bill To
Some Cie Some Other Cie
1111 chemin some-road 2222 chemin some-other-road
City-Here QC J0Q 1W0 Other City-Here QC J0Q 1W0
Canada Canada
I need to fetch the text in the 'Sold To' side. I tried to use the \r but it returns nothing! I don't know how to fetch the text from the start of the line until there's a bunch of spaces. Ex: Some Cie (if more than 1 spaces, go to next line)
then I have: Sold\sTo(?=\s{2,100})
but it won't work while (?=\s{2, 100})
returns everything!!!
I saw this: ^((?:\S+\s+){2}\S+).*
, which is very close to what I want, but I don't understand the whole thing. I would like to match from 2 to 5 words.
Then I have this: ^([A-Za-z0-9-]*)(?=\s{2,100})
which I thought would match At the beginning of the line until there's more than 2 spaces.
What am I getting wrong?
I need to do this in pure Regex (no flags allowed).
I'm completely lost. Some guidance would be much appreciated.