Jump to content

stringregexp help


Recommended Posts

i am trying to return the line shown below, which is in a text file along with hundreds of other lines of data:

The Sopranos @ s06e12 @ Kaisha @[ 04-Jun-2006 ]

using this search string:

The Sopranos - Kaisha .mpg

I know I can do this with string in string, but I want to use reg. expressions so i can add some fuzzy logic into it eventually. Note that there is a space bofre the line of text in the first line shown, but not in the second line, but there is a space after the episode name and before the ".mpg".

Can anyone help me?

EDIT: I figured out the regexp for this(i attached the code below), but it there a way to match case insensitive?, and how would i do it letter by letter or word by word? (so i can have it return a match if for example the search string was "the sopranos - the kaisha .mpg" (notice the "the" in the episode name, and the case of the whole string)

here is my initial code:

$filename = StringSplit("The Sopranos - Kaisha .mpg", " - ", 1) 


$showname = $filename[1]
$episodename = $filename[2]
$episodename = stringsplit($episodename, " .", 1)
$episodename = $episodename[1]
$listfile = fileopen("c:\program files\wget\test.txt", 0)

While 1
    $line = FileReadLine($listfile)

    If @error = -1 Then ExitLoop
;MsgBox(0,"",":"&$showname&":")
;MsgBox(0,"",":"&$episodename&":")
;MsgBox(0,"",$line)
    if StringRegExp($line, $showname) = 1 Then
        if StringRegExp($line, $episodename) = 1 Then
            ExitLoop
        EndIf
    EndIf
Wend

MsgBox(0,"",$line)
Edited by jjj
Link to comment
Share on other sites

Somthing like this?

Msgbox(0,"",StringRegExp("The Sopranos @ -- Found KasAThoy", "(.*(?i)sopranos.*kasa(?i).*)"))
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

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
 Share

  • Recently Browsing   0 members

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