Johnny Doe
Johnny Doe

Reputation: 193

Dynamically create regex pattern for match

using Visual.Web.Developer.2010.Express;

N00b here,
I'm in a pickle.. I'm trying to create a web application that has 2 text areas where the user can input 2 lists of names (for identifications sake, these text areas are aT2 and aT1).. aT2 contains names, and aT1 contains those same names, but I've altered them slightly to my preference. The thing is that aT2 contains names that aT1 doesn't have (which means I want to exclude the ones that aren't there after I filter through aT2) Basically searching through aT2 to see which ones match.


Here's a few in aT1:

ABC9910A
ABC42554
LOW3381
BD6210HFP
NWP448A1S
OTT123A04NS

Here's a few in aT2:

APPLEMACHINE    Y   ABC9910AIMAP
APPLEMACHINE    Y   ABC42554AIRAJZ
BANANABOI   Y   LOW33811CBZ
LLBLEAD TECHN   Y   NWP448A1S3LWXFTMA1
LLBLEAD TECHN   Y   OTT123A04NS4NSGATMA1


What i'm asking about is how would I dynamically create a new regex pattern for each item in aT1? You see how the first item in aT1 would match the first item in aT2? They almost always will not be in order like that... But dynamically create a search pattern for regex to search through aT2 for each item in 'aT1'.. If there is a match, it would print out that whole line of text before the linefeed in the text area.. Was I specific enough?? Is this even possible??
Thanks in advance

Upvotes: 0

Views: 1040

Answers (1)

CAbbott
CAbbott

Reputation: 8098

I think a RegEx pattern might be a bit of overkill for what you're asking. You might want to look at simply using Contains.

Upvotes: 1

Related Questions