Archive for the ‘ devel ’ Category

Own maven archetype problem with Eclipse Java Nature

Yep, i’ve build my own archetype and everytime i’ve created a new maven project with this archetype the java nature has been missing. So i’ve searched for more then 8 hours for a solution and finally found a small page of a developer who had the same problem. The solution is so easy … just delete the .metadata directory of your Eclipse Workspace and every Maven Project with your archetype will have the java nature in that Workspace out of the box.

Hope this helps :)

Regex to filter ISBN 10 and ISBN 13

In case of a project of two friends of mine, i have been asked to write a regular expression pattern that matches ISBN 10 and ISBN 13 in different notation ways. So the result looks crappy but it works nearly perfect … here it is:

((?=(?:978|979)[0-9 ]{14})(?:\d{3}[ ]{1}\d{1,5}[ ]{1}\d{2,7}[ ]{1}\d{2,7}[ ]{1}\d{1})|(?=(?:978|979)[0-9-]{14})(?:\d{3}[-]{1}\d{1,5}[-]{1}\d{2,7}[-]{1}\d{2,7}[-]{1}\d{1})|(?=(?:978|979)\d{10})(?:\d{13})|(?=[0-9xX]{10})(?:(?:\d{9}[xX]{1}|\d{10}))|(?=[0-9-xX]{13})(?:\d{1}[-]{1}\d{3,5}[-]{1}\d{3,5}[-]{1}[0-9xX]{1})|(?=[0-9xX ]{13})(?:\d{1}[ ]{1}\d{3,5}[ ]{1}\d{3,5}[ ]{1}[0-9xX]{1}))

It matches:

  • 1. 1234567891
  • 2. 1234567891011
  • 3. 3-446-19313-1
  • 4. 3 446 19313 1
  • 5. 978-3-86680-192-9
  • 6. 978 3 86680 192 9

Notice: I’m far-off from being a regex guru so please don’t argue about the syntax :)

Follow

Get every new post delivered to your Inbox.