Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Rex match

Posted on 2011-10-12
3
Medium Priority
?
371 Views
Last Modified: 2012-05-12
hey guys i have this rex matcher

// ### Grab the <TITLE> ###
 Match TitleMatch = Regex.Match(fileContents, "<title>([^<]*)</title>", RegexOptions.IgnoreCase | RegexOptions.Multiline);
filetitle = TitleMatch.Groups[1].Value;


i need to grab my aspx title

which is

Title="JC Web Internet Services | Your local trusted Durban ISP"

can any one help me so i can change my rex to find my new title text?
0
Comment
Question by:JCWEBHOST
3 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36955160
Is you pattern not working? It looks like you are inspecting the first capture group correctly, which is where the text of your title should be.
0
 
LVL 3

Expert Comment

by:KBerger
ID: 36955174
Hi,

try this (it's C#).

            string test = "<html><title>JC Web Internet Services | Your local trusted Durban ISP</title></html>";

            Regex ex = new Regex("(<title>)(.*)(</title>)");
            Match m = ex.Match(test);
            if (m.Groups.Count > 2)
            {
                Console.WriteLine("Title is: {0}", m.Groups[2]);
            }
            else
            {
                Console.WriteLine("Sorry, didn't get it");
            }
            Console.ReadLine();

Cheers,
-Kristof
0
 
LVL 18

Accepted Solution

by:
mgfranz earned 2000 total points
ID: 36956383
Try this;
 
// subjectString = "<title>JC Web Internet Services | Your local trusted Durban ISP</title>;
string resultString = null;
try {
	Regex regexObj = new Regex(@"<title[^>]*>(.*?)</title>
");
	resultString = regexObj.Match(subjectString).Value;
} catch (ArgumentException ex) {
	// Syntax error in the regular expression
}

Open in new window

0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question