A-Z*(?=\. A-Z) should capture everything you're after. Here it is broken down: java //Literal word "java" \s?
//Match for an optional space character. (can change to \s* if there can be multiple) ^A-Z* //Any number of non-capital-letter characters (?=\. A-Z) //Look ahead for (but don't add to selection) a literal period and a capital letter.
Without using capture groups (like @inTide used, which is fine), you can use lookahead (the (?= ... ) business). Java\s? ^A-Z*(?=\.
A-Z) should capture everything you're after. Here it is broken down: java //Literal word "java" \s? //Match for an optional space character.(can change to \s* if there can be multiple) ^A-Z* //Any number of non-capital-letter characters (?=\.
A-Z) //Look ahead for (but don't add to selection) a literal period and a capital letter.
Thanks a lot! I was confused about the lookahead thing, but the way you broke it down helped a lot! – uwdev12 Jul 11 at 21:28 Not a problem.
A suggestion - if you need help with regular expressions again, give regular-expressions. Info a shot, and look in their "Advanced Regex Syntax" section. :) – Nightfirecat Jul 11 at 21:30.
. A-Z' Everything in capture group one will be what you want.
. A-Z (thought? Might not be necessary, but it does not hurt either ;)) – Felix Kling Jul 11 at 21:07 @Felix You are correct, edited the oversight.
– inTide Jul 11 at 21:08.
A useful trick in cases like this is to prefix the regexp with the greedy pattern . *, which will try to match as many characters as possible before the rest of the pattern matches. * starts at the beginning of the string and matches as many characters as it can.
(The s modifier allows . To match even newlines.) The beginning-of-string anchor ^ is not strictly necessary, but it ensures that the regexp engine won't waste too much time backtracking if the match fails. \*/ just matches the literal string */.
(.*?) matches and captures any number of characters; the? Makes it ungreedy, so it prefers to match as few characters as possible in case there's more than one position where the rest of the regexp can match. Finally, ////RESULT just matches itself.
Since the pattern contains a lot of slashes, and since I wanted to avoid leaning toothpick syndrome, I decided to use alternative regexp delimiters. Exclamation points (!) are a popular choice, since they don't collide with any normal regexp syntax. The (?>) causes the pattern inside it to fail rather than accepting a suboptimal match (i.e.
One that extends beyond the first substring matching ////RESULT) even if that means that the rest of the regexp will fail to match.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.