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:
parent
39405592b8
commit
df13c3264b
|
@ -39,7 +39,7 @@ public class Utils {
|
||||||
/**
|
/**
|
||||||
* Hashtag regex enhanced for ticket #4937
|
* 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
|
* Pattern for URLS
|
||||||
|
|
|
@ -2,14 +2,12 @@ package org.gcube.social_networking.socialutillibrary;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
|
||||||
public class TestUnit {
|
public class TestUnit {
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
public void testHashtag() {
|
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);
|
List<String> hashtags = Utils.getHashTags(text);
|
||||||
System.out.println("Hashtags are " + hashtags);
|
System.out.println("Hashtags are " + hashtags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue