-1

I have a string of text example:

  • Today is hot.
  • Weather Is 18.
  • Last Week Was 20.
  • Yesterday Was Cold

I want to look for the key word say "Week" using regex match and it returns me the whole line "Last Week Was 20"

I have used .*Week. * which works but it matches individual letters as well so if I was to change to just W will still match when I want it to find a match on the whole phrase.

Also \bWeek\b will return just the work Week and not the Line.

Any help is greatly appreciated.

Thanks

cheno
  • 11
  • 1
  • 4

1 Answers1

0

I would use this

.+Week.+

Given the data of

Today is hot.

Weather Is 18.

Last Week Was 20.

Yesterday Was Cold

The result is:

Last Week Was 20.

Community
  • 1
  • 1
Kenny
  • 218
  • 1
  • 10