I need a regular expression that will only match the Letter "E" which is the first character in line of first sting so:
E<email>
I need to find incorporate regular expression that will only look for the lines that start with an E. Any ideas? Is it possible?
help with Regular Expression
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Please give complete examples of the lines that you are searching and describe precisely what in these lines you want to match. Please put your text examples in a "code" block, like this:
Code: Select all
to preserve the layout
Ok. Here is the example of content of the file:
ESKWAERKS@YAHOO.COM
SPPPPPP ELECTRONIC TTTT TTTTTTTT
BDateDDDDDD /30/02
ESKWAERK2@YAHOO.COM
SPPPPPP ELECTRONIC TTTT TTTTTTTT
BDateDDDDDD /30/02
Now I need to divide the file into mulitple files so it will become
File1
ESKWAERKS@YAHOO.COM
SPPPPPP ELECTRONIC TTTT TTTTTTTT
BDateDDDDDD /30/02
File2
ESKWAERK2@YAHOO.COM
SPPPPPP ELECTRONIC TTTT TTTTTTTT
BDateDDDDDD /30/02
I am using webMethods to do so and have a javaclass that will do it for me. The only thing that I need determine the delimiter in Regular Expression that will search for "E" as the first letter in the first string of the line. Hope its not to confusing.
ESKWAERKS@YAHOO.COM
SPPPPPP ELECTRONIC TTTT TTTTTTTT
BDateDDDDDD /30/02
ESKWAERK2@YAHOO.COM
SPPPPPP ELECTRONIC TTTT TTTTTTTT
BDateDDDDDD /30/02
Now I need to divide the file into mulitple files so it will become
File1
ESKWAERKS@YAHOO.COM
SPPPPPP ELECTRONIC TTTT TTTTTTTT
BDateDDDDDD /30/02
File2
ESKWAERK2@YAHOO.COM
SPPPPPP ELECTRONIC TTTT TTTTTTTT
BDateDDDDDD /30/02
I am using webMethods to do so and have a javaclass that will do it for me. The only thing that I need determine the delimiter in Regular Expression that will search for "E" as the first letter in the first string of the line. Hope its not to confusing.
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
Hmmm, I see a few problems you'll be having. The first is that you'd like to split the results out into a file per match and that is nothing a text editor is likely to do. The second is that you want to match the line that starts with E and the two lines after that. If it is always 3 lines that need matching, then
^E.*\n.*\n.*
will work to match. At this point, you'll still be stuck with how to split the file out. I suspect a quick script/program will be your best bet but if you are writing that, you might as well incorporate the regular expression into it.
^E.*\n.*\n.*
will work to match. At this point, you'll still be stuck with how to split the file out. I suspect a quick script/program will be your best bet but if you are writing that, you might as well incorporate the regular expression into it.
I choose to fight with a sack of angry cats.
In Textpad (you are here in a support forum for the text editor Textpad) ^ anchors the regex at the beginning of the line. Definitely.
If you are seeking support for some other regex engine here in the Textpad forum, the very least you should do is to specify that you are not talking about Textpad's regex engine, and which regex engine you do use.
Ok, you are using java - but still there are several regex engines implemented in Java (java.util.regex, gnu.regex, jakarta.regex, com.ibm.regex just to mention a few ...)
You should also mention how you are using your regex engine (flags in the calls might matter ...)
If you are seeking support for some other regex engine here in the Textpad forum, the very least you should do is to specify that you are not talking about Textpad's regex engine, and which regex engine you do use.
Ok, you are using java - but still there are several regex engines implemented in Java (java.util.regex, gnu.regex, jakarta.regex, com.ibm.regex just to mention a few ...)
You should also mention how you are using your regex engine (flags in the calls might matter ...)