regex - Slight adaptation of a User Defined Function -


i extract combination of text , numbers larger string located within column within excel.

the constants have work each text string will

•either start a, c or s, , •will 7 characters long •the position of string extract varies

the code have been using has been working efficiently is;

public function xtractor(r range) string dim a, ary ary = split(r.text, " ")     each in ary         if len(a) = 7 , "[sac]*"             xtractor =             exit function         end if     next xtractor = "" end function 

however today have learnt data may include scenarios this;

enter image description here

what adapt code if 8th character "underscore" , 1st character of 7 characters either s, or c please extract until "underscore"

secondly exclude commons words "support" & "collect" being extracted.

finally 7th letter should number

any ideas around appreciated.

thanks

try

ary = split(replace(r.text, "_", " ")) 

or

ary = split(replace(r.text, "_", " ")," ") 

result same both variants

test

enter image description here

update

do know how leave result blank if 7th character returned letter?

public function xtractor(r range) string dim a, ary ary = split(replace(r.text, "_", " "))     each in ary         if len(a) = 7 , "[sac]*" , isnumeric(mid(a, 7, 1))             xtractor =             exit function         end if     next xtractor = "" end function 

test

enter image description here


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -