Monday 15 August 2011

How to make Java regex to replace non-alphabetic signs and add underscores in Java class names? -



How to make Java regex to replace non-alphabetic signs and add underscores in Java class names? -

i generating java classes input represents model language. client creates input models, doesn´t care java, kind of names of classes:

1) struct+ 2) controller: 3) *

obviously, not compilable. need nice regex generate this:

1) struct_more 2) controller_prefix 3) all

could please help me sort out regex input?

i want underscore in between , replace non-alphabetic signs meaningfull , valid. thanks

well regex can't replace on own. you'd need match regex-meaning descriptive string. simple regex match non alphanumerical character somthing this:

[^a-za-z0-9]

java regex replace non-alphanumeric

No comments:

Post a Comment