Page 1 of 1

Find double digit number on either side of keyword

Posted: Thu Oct 05, 2017 4:52 am
by steve1040
Row1 = cooperative. he scored 25/30 on the m_m_s_e. language was fluent. he denies
Row2 = status, cognition, and cortical functions: m_m_s_e 21/30 · ****** status (including orientation to

each row contains the keyword "m_m_s_e"
I want to return the 2 digit value that may appear on either side of the keyword
between the space and "/"

So for row1 I'd get 25
and row2 I'd get 21

Posted: Thu Oct 05, 2017 8:54 am
by ben_josephs
How do you want to handle these MMSE scores?

If there is at most one score on a line and if you want to replace each line that contains a score with just the score, try:
Find what: .*?(?:\b(\d\d)\b.*m_m_s_e|m_m_s_e.*?\b(\d\d)\b).*
Replace with: $1$2
If you also want to remove lines that do not contain a score, try:
Find what: .*?(?:\b(\d\d)\b.*m_m_s_e|m_m_s_e.*?\b(\d\d)\b).*(\n)|.*\n
Replace with: $1$2$3
If you can rely just on the presence of the /30 part (as MMSE scores are always out of 30), these are simpler:
Find what: .*?\b(\d\d)/30.*
Replace with: $1$2
Find what: .*?\b(\d\d)/30.*(\n)|.*\n
Replace with: $1$2$3

Posted: Thu Oct 26, 2017 4:08 pm
by ben_josephs
Were these suggestions useful?