473,387 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Regular Expression ( [TAG-I] TEXT [TAG-F] )

Hi.. need help..

Sample text:

[NF-I]
nnn
nnn
nnn
nnn
nnn
[NF-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]
need get groups.... select return 4 groups.. like =
\[(?<InitialTag>.*)](?<Text>.*)\[(?<FinalTag>.*)]

but code return 1 match
[NF-I]
nnn....
[BB-F]
Thanks!

Nov 23 '06 #1
4 1336
help

On Nov 23, 1:58 pm, "Eduardo Luiz" <popov...@gmail.comwrote:
Hi.. need help..

Sample text:

[NF-I]
nnn
nnn
nnn
nnn
nnn
[NF-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]

need get groups.... select return 4 groups.. like =
\[(?<InitialTag>.*)](?<Text>.*)\[(?<FinalTag>.*)]

but code return 1 match
[NF-I]
nnn....
[BB-F]

Thanks!
Nov 23 '06 #2
(?<=\[(\w\w)-I\])[^\]]+(?=\[\1-F\])

It's hard to determine exactly what your rules are, so I used these:

The opening tag is defined as a left square-bracket followed by 2 word
characters, followed by a hyphen, followed by the character 'I', followed by
a right square-bracket. The closing tag is defined as a left square-bracket,
followed by the same 2 word characters in the opening tag, followed by a
hyphen, followed by the character 'F'. I used a positive look-behind, with a
group around the 2 characters preceding the hyphen, assumed that the
contents between would not contain the left squaare-bracket, and would
consist of at least one character, and a positive look-ahead, referencing
the same group from the positive look-behind. This results in a set of
matches of all characters between the opening and closing tags as I defined
them.

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

Never trust a dunderhead with a blunderbuss.
"Eduardo Luiz" <po******@gmail.comwrote in message
news:11*********************@m7g2000cwm.googlegrou ps.com...
Hi.. need help..

Sample text:

[NF-I]
nnn
nnn
nnn
nnn
nnn
[NF-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]
need get groups.... select return 4 groups.. like =
\[(?<InitialTag>.*)](?<Text>.*)\[(?<FinalTag>.*)]

but code return 1 match
[NF-I]
nnn....
[BB-F]
Thanks!

Nov 23 '06 #3

nice nice.. thanks!

im brazilian.. sorry my english..

im found a solution..

\[(?<TagInicial>.*?)](?<Texto>.*?)\[(?<TagFinal>.*?)]

Thanks a lot!
On Nov 23, 3:46 pm, "Kevin Spencer" <s...@uce.govwrote:
(?<=\[(\w\w)-I\])[^\]]+(?=\[\1-F\])

It's hard to determine exactly what your rules are, so I used these:

The opening tag is defined as a left square-bracket followed by 2 word
characters, followed by a hyphen, followed by the character 'I', followed by
a right square-bracket. The closing tag is defined as a left square-bracket,
followed by the same 2 word characters in the opening tag, followed by a
hyphen, followed by the character 'F'. I used a positive look-behind, with a
group around the 2 characters preceding the hyphen, assumed that the
contents between would not contain the left squaare-bracket, and would
consist of at least one character, and a positive look-ahead, referencing
the same group from the positive look-behind. This results in a set of
matches of all characters between the opening and closing tags as I defined
them.

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Developmenthttp://unclechutney.blogspot.com

Never trust a dunderhead with a blunderbuss.

"Eduardo Luiz" <popov...@gmail.comwrote in messagenews:11*********************@m7g2000cwm.goo glegroups.com...
Hi.. need help..
Sample text:
[NF-I]
nnn
nnn
nnn
nnn
nnn
[NF-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]
need get groups.... select return 4 groups.. like =
\[(?<InitialTag>.*)](?<Text>.*)\[(?<FinalTag>.*)]
but code return 1 match
[NF-I]
nnn....
[BB-F]
Thanks!- Hide quoted text -- Show quoted text -
Nov 23 '06 #4
You're very welcome. And there is certainly no need to apologize for your
English. The closest language to Portuguese that I can speak is Spanish, and
I'm not very good at that! And other than Spanish, I'm afraid English is the
only language I speak. The important thing is, we communicated successfully.

:-)

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

Never trust a dunderhead with a blunderbuss.
"Eduardo Luiz" <po******@gmail.comwrote in message
news:11**********************@j44g2000cwa.googlegr oups.com...
>
nice nice.. thanks!

im brazilian.. sorry my english..

im found a solution..

\[(?<TagInicial>.*?)](?<Texto>.*?)\[(?<TagFinal>.*?)]

Thanks a lot!
On Nov 23, 3:46 pm, "Kevin Spencer" <s...@uce.govwrote:
>(?<=\[(\w\w)-I\])[^\]]+(?=\[\1-F\])

It's hard to determine exactly what your rules are, so I used these:

The opening tag is defined as a left square-bracket followed by 2 word
characters, followed by a hyphen, followed by the character 'I', followed
by
a right square-bracket. The closing tag is defined as a left
square-bracket,
followed by the same 2 word characters in the opening tag, followed by a
hyphen, followed by the character 'F'. I used a positive look-behind,
with a
group around the 2 characters preceding the hyphen, assumed that the
contents between would not contain the left squaare-bracket, and would
consist of at least one character, and a positive look-ahead, referencing
the same group from the positive look-behind. This results in a set of
matches of all characters between the opening and closing tags as I
defined
them.

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Developmenthttp://unclechutney.blogspot.com

Never trust a dunderhead with a blunderbuss.

"Eduardo Luiz" <popov...@gmail.comwrote in
messagenews:11*********************@m7g2000cwm.go oglegroups.com...
Hi.. need help..
Sample text:
[NF-I]
nnn
nnn
nnn
nnn
nnn
[NF-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]
[BB-I]
nnn
[BB-F]
need get groups.... select return 4 groups.. like =
\[(?<InitialTag>.*)](?<Text>.*)\[(?<FinalTag>.*)]
but code return 1 match
[NF-I]
nnn....
[BB-F]
Thanks!- Hide quoted text -- Show quoted text -

Nov 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bradley Plett | last post by:
I'm hopeless at regular expressions (I just don't use them often enough to gain/maintain knowledge), but I need one now and am looking for help. I need to parse through a document to find a URL,...
9
by: MJ | last post by:
HI I want to know what is mean by regular expression in C Mayur
11
by: Dimitris Georgakopuolos | last post by:
Hello, I have a text file that I load up to a string. The text includes certain expression like {firstName} or {userName} that I want to match and then replace with a new expression. However,...
10
by: Lee Kuhn | last post by:
I am trying the create a regular expression that will essentially match characters in the middle of a fixed-length string. The string may be any characters, but will always be the same length. In...
2
by: Sehboo | last post by:
Hi, I have several regular expressions that I need to run against documents. Is it possible to combine several expressions in one expression in Regex object. So that it is faster, or will I...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
6
by: rorymo | last post by:
I have a regular expression that allows only certain characters to be valid in an xml doc as follows: <xs:pattern value="^*" /> What I want to do is also allow any unicode character that is...
1
by: Allan Ebdrup | last post by:
I have a dynamic list of regular expressions, the expressions don't change very often but they can change. And I have a single string that I want to match the regular expressions against and find...
5
by: shawnmkramer | last post by:
Anyone every heard of the Regex.IsMatch and Regex.Match methods just hanging and eventually getting a message "Requested Service not found"? I have the following pattern: ^(?<OrgCity>(+)+),...
1
by: NvrBst | last post by:
I want to use the .replace() method with the regular expression /^ %VAR % =,($|&)/. The following DOESN'T replace the "^default.aspx=,($|&)" regular expression with "":...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.