Stuart’s MATLAB Videos

Watch and Learn

Handling Multiple Match Tokens in My Web App

Now I want to modify the MATLAB app I recently made to scrape web pages, so that it can handle multiple multi-part patterns. i.e. where there are more than one token in the regular expression match pattern.

I’ll use this example where I want to find the href attributes and the link text for all the links on a web page (for multiple pages).

So, for the example string:

 <a href="/academia.html?s_tid=gn_acad">Academia</a>

I want to extract:

  1. /academia.html?s_tid=gn_acad
  2. Academia

So I will use this regex pattern:

<a href="([^"]*)">([^<]*)</a>

Features covered in this code-along style video include:

Play the video in full screen mode for a better viewing experience. 

|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.