-1
"Lives in <a href="http://www.facebook.com/pages/Salt-Lake-City-Utah/106057819434480" data-hovercard="/ajax/hovercard/page.php?id=106057819434480">Salt Lake City, Utah</a></span></span><span class="fbProfileBylineFragment"><span class="fbProfileBylineIconContainer"><i class="mrs fbProfileBylineIcon img sp_19lyo5 sx_3060a4"></i></span><span class="fbProfileBylineLabel">In a Relationship</span></span><span class="fbProfileBylineFragment"><span class="fbProfileBylineIconContainer"><i class="mrs fbProfileBylineIcon img sp_19lyo5 sx_02e908"></i></span><span class="fbProfileBylineLabel">From <a href="http://www.facebook.com/pages/Ho-Chi-Minh-City-Vietnam/108458769184495" data-hovercard="/ajax/hovercard/page.php?id=108458769184495">Ho Chi Minh City, Vietnam</a></span></span></div></div></div><a class="title" href="http://www.facebook.com/thdnguyen/info" aria-label="About Thang Duc Nguyen"><span class="text">About</span></a></div></div></li><li class="friends tile firstTab" id="pagelet_timeline_friends_nav_top"><div id="pagelet_timeline_friends_nav_top" data-referrer="pagelet_timeline_friends_nav_top_tc"><div class="modify" id="u_0_u"><a class="tab" href="http://www.facebook.com/thdnguyen/friends?ft_ref=mni"><div class="detail"><img class="friend hovercard_trigger img" src="http://profile.ak.fbcdn.net/hprofile-ak-ash4/372716_1823442806_2006030279_q.jpg" alt="Thanh Tu" data-hovercard="/ajax/hovercard/hovercard.php?id=1823442806" data-gt="&#123;&quot;coeff2_registry_key&quot;:&quot;0171&quot;,&quot;coeff2_info&quot;:&quot;AavbyaRCgBvdhZfDCJWU-1D0XS9C9xYK9mP-XAjVkbJZISJXe7vormiJvifh83A0MaQ&quot;,&quot;coeff2_action&quot;:&quot;7&quot;,&quot;coeff2_pv_signature&quot;:&quot;900209238&quot;&#125;" tabindex="-1" id="u_0_v" /><img class="friend hovercard_trigger img" src="http://profile.ak.fbcdn.net/hprofile-ak-prn1/157747_1207242302_43629620_q.jpg" alt="Khuong Ly" data-hovercard="/ajax/hovercard/hovercard.php?id=1207242302" data-gt="&#123;&quot;coeff2_registry_key&quot;:&quot;0171&quot;,&quot;coeff2_info&quot;:&quot;AavPGDyDTok7B4j0_HSLcSkhQ3kZ0ZJp6DuZ66N3ieCvIbwAElfVzNWwcDWmaCtMZxk&quot;,&quot;coeff2_action&quot;:&quot;7&quot;,&quot;coeff2_pv_signature&quot;:&quot;900209238&quot;&#125;" tabindex="-1" id="u_0_w" /><img class="friend hovercard_trigger img" src="http://profile.ak.fbcdn.net/hprofile-ak-ash4/274290_1289768677_1335638163_q.jpg" alt="Jimmy Nguyen" data-hovercard="/ajax/hovercard/hovercard.php?id=1289768677" data-gt="&#123;&quot;coeff2_registry_key&quot;:&quot;0171&quot;,&quot;coeff2_info&quot;:&quot;AavimNr_nNQOjE_GUv9rK9Y53Wb0AINs2esyyYHwWkYlCUR9k4s3bjv2zuX9ZC_zl0Y&quot;,&quot;coeff2_action&quot;:&quot;7&quot;,&quot;coeff2_pv_signature&quot;:&quot;900209238&quot;&#125;" tabindex="-1" id="u_0_x" /><img class="friend hovercard_trigger img" src="http://profile.ak.fbcdn.net/hprofile-ak-ash4/371515_1595704919_1332516967_q.jpg" alt="Phan Huu Duong" data-hovercard="/ajax/hovercard/hovercard.php?id=1595704919" data-gt="&#123;&quot;coeff2_registry_key&quot;:&quot;0171&quot;,&quot;coeff2_info&quot;:&quot;AauiC-fIYS2uiXgKMG1caBF5Oa7EQ5G8fw1cj_BytuODRnvmIXrcupg5R_oaUapQrwc&quot;,&quot;coeff2_action&quot;:&quot;7&quot;,&quot;coeff2_pv_signature&quot;:&quot;900209238&quot;&#125;" tabindex="-1" id="u_0_y" /><img class="friend hovercard_trigger img" src="http://profile.ak.fbcdn.net/hprofile-ak-prn1/27350_579556704_1248743264_q.jpg" alt="Shinbi Han" data-hovercard="/ajax/hovercard/hovercard.php?id=579556704" data-gt="&#123;&quot;coeff2_registry_key&quot;:&quot;0171&quot;,&quot;coeff2_info&quot;:&quot;AavEMYXuvUDOiYAw0rF9CRUi99YwRuu2lfGGx7fTwpCNfOSr4ZfXWNSAb94LtYaL52U&quot;,&quot;coeff2_action&quot;:&quot;7&quot;,&quot;coeff2_pv_signature&quot;:&quot;900209238&quot;&#125;" tabindex="-1" id="u_0_z" /><img class="friend hovercard_trigger img" src="http://profile.ak.fbcdn.net/hprofile-ak-snc6/187628_536415512_687099069_q.jpg" alt="Ph&#x1b0;&#x1a1;ng Dung" data-hovercard="/ajax/hovercard/hovercard.php?id=536415512" data-gt="&#123;&quot;coeff2_registry_key&quot;:&quot;0171&quot;,&quot;coeff2_info&quot;:&quot;AattmnwhiMdkaTVRwQWbQOW6LgoyyJLT0YiOtB8mJMN2ClaSo0eRUG65DVpL0aIdhs0&quot;,&quot;coeff2_action&quot;:&quot;7&quot;,&quot;coeff2_pv_signature&quot;:&quot;900209238&quot;&#125;" tabindex="-1" id="u_0_10" /></div><div class="frame"><div class="mat"></div></div><div class="fbTimelineRibbon"><div class="text">56 Mutual</div></div><div class="title"><span class="icon"><i class="img sp_19lyo5 sx_9f0f9c"></i></span><span class="text">Friends</span><span class="count">343</span></div></a></div></div></li><li class="photos tile " id="pagelet_timeline_photos_nav_top"><div id="pagelet_timeline_photos_nav_top" data-referrer="pagelet_timeline_photos_nav_top_tc"><div class="modify" id="u_0_17"><a class="tab" href="http://www.facebook.com/thdnguyen/photos"><div class="detail"><i style="background-image: url(&#039;http://photos-d.ak.fbcdn.net/hphotos-ak-snc7/312328_540065199344675_1438624962_a.jpg&#039;);background-position: 10% 79%;" class="photo"></i></div><div class="frame"><div class="mat"></div></div><div class="title"><span class="icon"><i class="img sp_4mjn73 sx_636b00"></i></span><span class="text">Photos</span><span class="count">217</span></div></a></div></div></li><li class="map tile " id="pagelet_timeline_map_nav_top"><div id="pagelet_timeline_map_nav_top" data-referrer="pagelet_timeline_map_nav_top_tc"><div class="modify" id="u_0_15"><a class="tab" href="http://www.facebook.com/thdnguyen/map"><div class="detail"><img class="img" src="http://external.ak.fbcdn.net/safe_image.php?d=AQAC3nvFphWDJjkh&amp;url=http%3A%2F%2Ffb.ecn.api.tiles.virtualearth.net%2Fapi%2FGetMap.ashx%3Fb%3Dr%252Cmkt.en-US%252Cstl.fb%26key%3DAqSHdMNkhSvgWwMhbqyiqgW1IhMNeV56Gb0WkfgEDm6jSsfX9gDGmlOUEt3i44Jk%26td%3DD1%26h%3D74%26w%3D111%26ppl%3D54%252C%252C40.2487%252C-111.6467%26z%3D8&amp;jq=100" alt="" width="111" height="74" /><div class="mapSubtitle">BYU Wilkinson Center</div></div><div class="frame"><div class="mat"></div></div><div class="title"><span class="icon"><i class="img sp_6b0izw sx_dbd31f"></i></span><span class="text">Map</span><span class="count">26</span></div></a></div></div></li><li class="favorites tile " id="pagelet_timeline_favorites_nav_top"><div id="pagelet_timeline_favorites_nav_top" data-referrer="pagelet_timeline_favorites_nav_top_tc"><div class="modify" id="u_0_14"><a class="tab" href="http://www.facebook.com/thdnguyen/favorites"><div class="detail"><div class="first panel"><img class="liked img" src="http://profile.ak.fbcdn.net/hprofile-ak-snc6/203541_422548671139516_791692913_s.jpg" alt="" /></div><div class="panel"><img class="liked img" src="http://profile.ak.fbcdn.net/hprofile-ak-snc6/203522_363819460365598_301463621_s.jpg" alt="" /></div></div><div class="frame"><div class="mat"></div></div><div class="title"><span class="icon"><i class="img sp_8y8k5s sx_d48dae"></i></span><span class="text">Likes</span><span class="count">44</span></div></a></div></div></li><li class="followers tile " id="pagelet_timeline_followers_nav_top"><div id="pagelet_timeline_followers_nav_top" data-referrer="pagelet_timeline_followers_nav_top_tc"><div class="modify" id="u_0_p"><a class="tab" href="http://www.facebook.com/thdnguyen/followers"><div class="detail"><div><table class="uiGrid statsContainer" cellspacing="0" cellpadding="0"><tbody><tr><td class="vMid hCent stats"><span class="_wj fwb">1</span></td></tr></tbody></table></div></div><div class="frame"><div class="mat"></div></div><div class="title"><span class="icon"><i class="img sp_19lyo5 sx_910af8"></i></span><span class="text">Followers</span></div></a></div></div></li><li class="following tile " id="pagelet_timeline_following_nav_top"><div id="pagelet_timeline_following_nav_top" data-referrer="pagelet_timeline_following_nav_top_tc"><i id="u_0_11"></i></div></li><li class="events tile " id="pagelet_timeline_events_nav_top"><div id="pagelet_timeline_events_nav_top" data-referrer="pagelet_timeline_events_nav_top_tc"><div class="modify" id="u_0_16"><a class="tab" href="http://www.facebook.com/thdnguyen/events"><div class="detail"><i style="background-image: url(&#039;http://profile.ak.fbcdn.net/hprofile-ak-snc6/276528_475960892426464_856733486_n.jpg&#039;)" class="event"></i></div><div class="frame"><div class="mat"></div></div><div class="title"><span class="icon"><img class="img" src="http://static.ak.fbcdn.net/rsrc.php/v2/yS/r/UcZE_y8-JDf.png" alt="" width="15" height="16" /></span><span class="text">Events</span></div></a></div></div></li><li class="notes tile " id="pagelet_timeline_notes_nav_top"><div id="pagelet_timeline_notes_nav_top" data-referrer="pagelet_timeline_notes_nav_top_tc"><div class="modify" id="u_0_13"><a class="tab" href="http://www.facebook.com/thdnguyen/notes"><div class="detail"><div class="note"><div class="content"><div class="name">8 months</div><span>        I should start this boring thing when the college is over on May 16 that</span></div></div></div><div class="frame"><div class="mat"></div></div><div class="title"><span class="icon"><i class="img sp_4mjn73 sx_f82ad6"></i></span><span class="text">Notes</span><span class="count">1</span></div></a></div></div></li><li class="og_ns_music tile " id="pagelet_timeline_og_nav_og_ns_music_top"><div id="pagelet_timeline_og_nav_og_ns_music_top" data-referrer="pagelet_timeline_og_nav_og_ns_music_top_tc"><div class="modify" id="u_0_12"><a class="tab" href="http://www.facebook.com/thdnguyen/music"><div class="detail"><div class="uiScaledImageContainer photo"><img class="scaledImageFitWidth img" src="http://external.ak.fbcdn.net/safe_image.php?d=AQD8v7DoEhwQwP1p&amp;w=200&amp;h=200&amp;url=http%3A%2F%2Fo.scdn.co%2Funbranded%2Fdd77ec2b2f2a51017d8ebe60413400bf193a8de2&amp;crop" style="top:-17px;" alt="" width="109" height="109" /></div></div><div class="frame"><div class="mat"></div></div><div class="title"><span class="icon"><i class="img sp_4mjn73 sx_040c01"></i></span><span class="text">Music</span></div></a></div></div></li><li class="hidden_elem empty tile"><div class="add"><a class="tab" href="#"><div class="detail"></div><div class="frame"><div class="mat"></div></div><div class="title"></div></a></div></li><li class="hidden_elem empty tile"><div class="add"><a class="tab" href="#"><div class="detail"></div><div class="frame"><div class="mat"></div></div><div class="title"></div></a></div></li><li class="hidden_elem empty tile"><div class="add"><a class="tab" href="#"><div class="detail"></div><div class="frame"><div class="mat"></div></div><div class="title"></div></a></div></li><li class="hidden_elem empty tile"><div class="add"><a class="tab" href="#"><div class="detail"></div><div class="frame"><div class="mat"></div></div><div class="title"></div></a></div></li><li class="hidden_elem empty tile"><div class="add"><a class="tab" href="#"><div class="detail"></div><div class="frame"><div class="mat"></div></div><div class="title"></div></a></div></li><li class="hidden_elem empty tile"><div class="add"><a class="tab" href="#"><div class="detail"></div><div class="frame"><div class="mat"></div></div><div class="title"></div></a></div></li><li class="hidden_elem empty tile"><div class="add"><a class="tab" href="#"><div class="detail"></div><div class="frame"><div class="mat"></div></div><div class="title"></div></a></div></li><li class="hidden_elem empty tile"><div class="add"><a class="tab" href="#"><div class="detail"></div><div class="frame"><div class="mat"></div></div><div class="title"></div></a></div></li></ul><a class="fbTimelineMoreButton seemore stat_elem fbTimelineMoreButtonZero" href="#" id="u_0_o"><div class="detail frame"><div class="mat"></div><div class="fbTimelineRibbon"><div class="text"> </div></div></div><div class="title">More</div></a>"

我需要的只是刚开始时犹他州盐湖城

我是 JavaScript 正则表达式的新手,非常感谢。

4

2 回答 2

3

不需要正则表达式,使用 DOM 方法:

var element = document.createElement("div");
element.innerHTML = responseText;

console.log(element.getElementsByTagName("a")[0].innerHTML);

演示:http: //jsfiddle.net/j3MLa/

于 2013-01-26T19:57:43.590 回答
0

看起来你只是想匹配一个值,在这种情况下不需要使用正则表达式,只需搜索字符串。更一般地说,虽然这样做很诱人,但您不能使用正则表达式解析 html

于 2013-01-26T19:57:48.797 回答