• Post Reply Bookmark Topic Watch Topic
  • New Topic

Rowfilter regexFilter digits as strings

 
Ionut Popa
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all (or hello world )! This is my first post here even dough i read the forum pretty often for documentation.
I have a jtable and some of the columns contain string data that consist of numbers (i display phone numbers and I store them as strings). the problem is that I can not find a regular expression that can match these strings.
Regular matches like a digit itself do not work. I have even tried to see if it matches anything but it still doesn't work. Any ideas?
 
Ionut Popa
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone? what regex's are accepted by regexfilter? why doesn't it work for numbers in the strings?
 
Ionut Popa
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
up with it
 
Rob Camick
Ranch Hand
Posts: 2700
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the Swing tutorial on "How to Use Tables" for the working example of filtering. The tutorial just uses the text as it was entered into the text field. That is they don't use any special regex characters.
 
Ionut Popa
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup i've looked there but it doesn't work for strings with digits in them (the filtering). I have a couple of columns with digits stored as strings.
 
Rob Camick
Ranch Hand
Posts: 2700
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works fine for me.
 
Ionut Popa
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if you let's say enter digits in the text field and use that value for the rowFilter? Does it filter by strings with digits in them?
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to reapply the filter for the new filter to become effective.
 
Ionut Popa
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand. Can you give a code example?
 
Rob Camick
Ranch Hand
Posts: 2700
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The example from the Swing tutorial works. All you need to do is change the data in the first column to contain phone numbers.
 
Ionut Popa
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn' work for me. I have a column with strings that contain only numbers...
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then please post a SSCCE - just the JFrame, JTable (with static data) and the row filter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!