0
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

5
  • 1
    Would string.Contains suffice, or is a regular expression necessary? Commented May 23, 2012 at 20:25
  • @mellamokb I didn't know that existed.. I think it would. No it's not necessary Commented May 23, 2012 at 20:32
  • Do you have LINQ available to use? Commented May 23, 2012 at 20:34
  • @mellamokb I can, but I think string.contains will do.. Would you recommend LINQ over string.contains? Commented May 23, 2012 at 20:35
  • No, LINQ would be a simple way to compare all the entries in aT1 with all the entries in aT2, using a .Join or something like that. More for the higher-level data processing. Commented May 23, 2012 at 20:57

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.