1

I have a string as mentioned below, basically data is coming to me in excel file. Some rows are proper data and for these proper data rows I am able to fetch what I need using the lua pattern. Below is the proper data row

2011/02 ARRTC AAUUMCO ZZITNWMOBILE COMMUNICATIONS CENTER ARRTC-AAUUM-TBT-2011-02 0.00 AAUUM_ARRTC_0211_TBT 18.03 18.03 EUR 1.14977 20.73 20.73

and I am using below pattern and everything is working fine.

rPattern = "(%d%d%d%d%/%d%d)%s*(%w%w%w[%w%d][%w%d])%s*(%w%w%w[%w%d][%w%d]).-[%u%d%-%s]-([%d%.%,]+)%s*([%u%d_%-]-)%s*([%d%.%,]+)%s*([%d%.%,]+)%s*(%u%u%u)%s*(%d+%.%d*)%s*(.-)\n"

Now some rows are coming with HTML tags, means my data is inside the html tags. The only trick I need is to fetch my required string within the HTML tags. the bugged row is

2011/02 ARRTC   AAUUMCO ZZITNWMOBILE COMMUNICATIONS CENTER  ARRTC-AAUUM-TBT-2011-02 0.00    <a href="/cgi-bin/recon_detail?rectent=AAUUM&benificary=ARRTC&period=2011/02&svctype=Voice">AAUUM_ARRTC_0211_TBT</a>    18.03   18.03   EUR 1.14977 20.73   20.73

now from the above row I want to fetch AAUUM_ARRTC_0211_TBT

I am trying trying and trying but unable to do it. Can somebody will help me to fix my above patternd?

Thanks

2
  • What is the exact thing you are looking for? Is it the first content between matching tags? Commented Jun 30, 2011 at 19:10
  • I have updated my post. Hope it will give you some more detail Commented Jul 1, 2011 at 8:43

2 Answers 2

2

Try print(str:match(">(.-)<")).

Sign up to request clarification or add additional context in comments.

1 Comment

I have updated my post. Hope it will give you some more detail
1

Lua pattern matching is incapable of parsing HTML. While the ">(.-)<" pattern would work in this particular instance, it would not be a general solution for arbitrary HTML.

1 Comment

I have updated my post. Hope it will give you some more detail

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.