minor regex for hashtag fix

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-util-library@148948 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-05-23 09:33:47 +00:00
parent 39405592b8
commit df13c3264b
2 changed files with 2 additions and 4 deletions

View File

@ -39,7 +39,7 @@ public class Utils {
/**
* Hashtag regex enhanced for ticket #4937
*/
private static final String HASHTAG_REGEX = "^#\\w+([.]?\\w+)*|\\s#\\w+([.]?\\w+)*|#\\w+([.]?\\w+)*";
private static final String HASHTAG_REGEX = "^#\\w+([.]?\\w+)*|\\s#\\w+([.]?\\w+)*|(?<=[\\[({])#\\w+([.]?\\w+)";
/**
* Pattern for URLS

View File

@ -2,14 +2,12 @@ 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 and (#ga) tewrw";
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 and https://www.local.it/#here";
List<String> hashtags = Utils.getHashTags(text);
System.out.println("Hashtags are " + hashtags);
}