Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REGEX grab content between tags 1

Status
Not open for further replies.

NetworkGhost

IS-IT--Management
Apr 12, 2005
1,324
US
Trying grab the number out of the following string:

<span class="intronum"><sort date-type="number" select="//meta/@tot"></sort>1120</span>

Using the following:

cat file | grep </sort\b[^>]*>(.*?)</span>

I definitly need to buff up on Regex but could use some help. Thanks.

Free Firewall/Network/Systems Support-
 
Hi

You mean to convert that [tt]grep[/tt] into Tcl ? Your regular expression is quite Ok, but in Tcl the [tt]\b[/tt] means backspace character, not word boundary.
Code:
[b]set[/b] html [i]{<span class="intronum"><sort date-type="number" select="//meta/@tot"></sort>1120</span>}[/i]

[b]regexp[/b] [i]{</sort\M[^>]*>(.*?)</span>}[/i] $html match match

[b]puts[/b] $match

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top