Hi,
I am not an expert (by any means) here.
I am trying to create a regex to find a bracketed year e.g. (1967)
I have several that work OK when used within java code, but do not work inside textpad.
1. ([(]\d{4}[)])
2. \(\d\d\d\d\)
3. \(\d{4}\)
They are not the most sophisticated or efficient, but as far as I can see should be OK.
Thanks
Mark
this regex does not seem to work
Moderators: AmigoJack, bbadmin, helios, MudGuard
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
Use Posix regular expression syntax:
Also, you don't need the outer parentheses in the first example.
So any of these will work:
1. [(][0-9]{4}[)]
2. \([0-9][0-9][0-9][0-9]\)
3. \([0-9]{4}\)
Edit: Corrected typo.
The regex \d isn't accepted by TextPad. Use [0-9] instead.Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
Also, you don't need the outer parentheses in the first example.
So any of these will work:
1. [(][0-9]{4}[)]
2. \([0-9][0-9][0-9][0-9]\)
3. \([0-9]{4}\)
Edit: Corrected typo.
Last edited by ben_josephs on Fri Sep 04, 2009 1:26 pm, edited 1 time in total.