javascript - Google Script parsing text -


i have google script program working parsing text. i'm having trouble finding right functions or regular expressions job done. should pull name out of email (which should first thing in email).

here's i'm trying parse out far:

derek antrican<br /> <br /> ==================================================================<br /> mobile text message brought at&amp;t<br /> 

basically want code take current string above, sort out first 1 or 2 full words (anything before html line break tag) , assign resulting string variable "parse".

here's have far code:

//var loc = body.findtext("\a\w*\s\w*"); //var ele = loc.getelement(); //var parse = ele.gettext(); 

i'm new both regular expressions , javascript, missing obvious.

a simple method doesn't require regular expressions split on " <br " , take first element:

var parsed_text = body.split('<br')[0];


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -