the regex now recognizes hashtags within parenthesis e.g. (#ga)
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-util-library@148945 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ec42be9402
commit
39405592b8
|
@ -39,7 +39,7 @@ public class Utils {
|
|||
/**
|
||||
* Hashtag regex enhanced for ticket #4937
|
||||
*/
|
||||
private static final String HASHTAG_REGEX = "^#\\w+([.]?\\w+)*|\\s#\\w+([.]?\\w+)*";
|
||||
private static final String HASHTAG_REGEX = "^#\\w+([.]?\\w+)*|\\s#\\w+([.]?\\w+)*|#\\w+([.]?\\w+)*";
|
||||
|
||||
/**
|
||||
* Pattern for URLS
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.gcube.social_networking.socialutillibrary;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class TestUnit {
|
||||
|
||||
//@Test
|
||||
public void testHashtag() {
|
||||
String text = "This is a test with hashtag #T6 and #T6.1 but also #T6. that has '.' that is useless and #T43.43 and #gcube4.1.0gcore #gcube4.1.0";
|
||||
String text = "This is a test with hashtag #T6 and #T6.1 but also #T6. that has '.' that is useless and #T43.43 and #gcube4.1.0gcore #gcube4.1.0 and (#ga) tewrw";
|
||||
List<String> hashtags = Utils.getHashTags(text);
|
||||
System.out.println("Hashtags are " + hashtags);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue