Hi all ,
i have a string var containing info like this.

STRING = "Are you posting in the most appropriate place PKG0620_REL_23_Nov_2010 to receive relevant replies"

So, my program will ask only "PKG0620" info to be given by the user which i am storing in SEARCH var.

SEARCH = "PKG0620".

========================================================================================
So i want to know how to extract the "PKG0620_REL_23_Nov_2010" info in separate variable (MATCHINFO) using regular expression..

Please Help

Recommended Answers

All 5 Replies

Hi all ,
i have a string var containing info like this.

STRING = "Are you posting in the most appropriate place PKG0620_REL_23_Nov_2010 to receive relevant replies"

So, my program will ask only "PKG0620" info to be given by the user which i am storing in SEARCH var.

SEARCH = "PKG0620".

========================================================================================
So i want to know how to extract the "PKG0620_REL_23_Nov_2010" info in separate variable (MATCHINFO) using regular expression..

Please Help

Please confirm that the only data you want to capture is PKG0620.

I want to capture "PKG0620_REL_23_Nov_2010" for the given "PKG0620"

I'm still not sure what you mean, but the attached will prompt users for something, and give a result:

Private Sub Command1_Click()

Dim StrSearch As String
Dim intResponse As Integer
Dim strResult As String

StrSearch = InputBox("Please enter Submission Code")
intResponse = MsgBox("Are you posting in the most appropriate place " & StrSearch & _
" _REL_23_Nov_2010 to receive relevant replies", vbYesNo, "Title")
If intResponse = vbYes Then
strResult = StrSearch & "_REL_23_Nov_2010"
MsgBox strResult
Else
'write error code
End If


End Sub

Note that this works in vb6. You will have to tweak it to get the same result in vb.net. Also, what is the "_REL_23_Nov_2010" data. is this hard code, or could it be generated by something like the system date?

DIM myMatch as Match
DIM userInput as String
Dim searchString as String

myMatch = Regex.Match(searchString, userInput & @"\w+");

Thanks Momerath

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.