Jump to content

Recommended Posts

Posted

I am trying to get some data from a string

$Info = StringRegExp($Source, 'target="_blank">?\s?(?:<strong>|title="">)?(.*?)\s(?i:Ch?H?\s*?(\d+)|(\d+)).torrent', 1)

There are 2 different types of names

target="_blank" title="">TVSHOWNAME 2010-01-16.torrent

target="_blank" title="">TVSHOWNAME CH01.torrent

I want to get

1. TVSHOWNAME (this part is working)

2. either 20100116 or 01 (01 works but not sure how to get the 20100116 to work)

Posted (edited)

This might help.

#include <Array.au3>

Local $Source = 'target="_blank" title="">TVSHOWNAME 2010-01-16.torrent' & @CRLF & _
        'target="_blank" title="">TVSHOWNAME CH01.torrent'

Local $Info = StringTrimRight(StringRegExpReplace($Source, _
        'target=.*?="">(.*?)\s(?:[^\d]*)([\d]+)(?:[^\d]?)([\d]{0,2})(?:[^\d]?)([\d]{0,2})\.torrent', _
        "\1 \2\3\4 "), 2) ; 2 spaces after \1 and 2 spaces after \4
ConsoleWrite($Info & @CRLF)

Local $aInfo = StringSplit($Info, " ", 3) ; 2 spaces within " "

_ArrayDisplay($aInfo)

Edit: It appears the 2 spaces auto-change into 1 space.

So please check that the 3 places that require 2 spaces do have 2 spaces and not 1 space.

Edited by Malkey

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...