Regular expression updated. Now it recognizes also hashtags such as #gcube4.1.0, #gcube4.1.0gcore etc
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-util-library@132611 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1cd487a832
commit
483c585f14
|
@ -38,9 +38,8 @@ public class Utils {
|
|||
|
||||
/**
|
||||
* Hashtag regex enhanced for ticket #4937
|
||||
* If you want to accept hashtags of type #X, then you will need to use ^#\\w*[.]?\\w+|\\s#\\w*[.]?\\w+
|
||||
*/
|
||||
private static final String HASHTAG_REGEX = "^#\\w+[.]?\\w+|\\s#\\w+[.]?\\w+";
|
||||
private static final String HASHTAG_REGEX = "^#\\w+([.]?\\w+)*|\\s#\\w+([.]?\\w+)*";
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -254,7 +253,7 @@ public class Utils {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* convert the mentioned people in HTML anchor and also Encode the params Base64
|
||||
* @param escapedFeedText
|
||||
* @param taggedPeople
|
||||
|
|
|
@ -8,7 +8,7 @@ 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 .";
|
||||
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";
|
||||
List<String> hashtags = Utils.getHashTags(text);
|
||||
System.out.println("Hashtags are " + hashtags);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue