Community Forums

General => General board => Topic started by: grayger on September 21, 2007, 01:42:06 am



Title: regular expression support
Post by: grayger on September 21, 2007, 01:42:06 am
It is a great tool!

I am enjoying it, but I can't find how to check some basic rules.
For example, there is well-known Java coding standard: Class name starts with uppercase.
If string.matches() supports regular expression, it could be possible.

Do you have any idea?


Title: Re: regular expression support
Post by: Oege de Moor on September 23, 2007, 10:42:24 am
Glad you like SemmleCode, and sorry for the delay in replying.

We've added string operations, and they'll be available in the next release - this
will enable you to write the "class name starts with uppercase" query.
Full regexp support is also in the pipeline, but a bit more difficult to support
on all the different database backends.

The next release will come out in a few days.


Title: Re: regular expression support
Post by: elnar on September 30, 2007, 10:20:52 pm
The new release of SemmleCode plugin has now four new functions on strings: length, substring, toUpperCase and toLowerCase. Using these methods one can easily express a query to find all reference types that have names that do not start with an upper case letter. Here is one example:

Code:
from RefType t, string s
where s = t.getName().substring(1,1)
and s.toUpperCase() != s
select t

Enjoy!