Extract string from string using Regex
- by stacker
I want to extract MasterPage value directive from a view page. I want the fastest way to do that, taking into account a very big aspx pages, and a very small ones.
I think the best way is to do that with two stages:
Extract the page directive section from the view (using Regex):
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
Then, extract the value inside MasterPageFile attribute.
The result needs to be: ~/Views/Shared/Site.Master.
Can I have help from someone to implement this? I badly want to use only regex, but I don't Regex expert.
Another thing, Do you think that Regex is the fastest way to do this?