2

i am using Linkify with a custom TransformFilter. Is it possible to tell linkify to only match the first occurence of my pattern?

Sira Lam
  • 5,179
  • 3
  • 34
  • 68
Ben
  • 16,124
  • 22
  • 77
  • 122

1 Answers1

2

I would use a MatchFilter for that, like this

   MatchFilter matcher = new MatchFilter() {
        boolean firstTime;
        @Override
        public boolean acceptMatch(CharSequence s, int start, int end) {
            if(firstTime) {
                return true;
                firstTime = false;
            } else {
                return false;
            }
        }
    };

Hope it helps

momo
  • 106
  • 1
  • 5