fix for #10700
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-util-library@160503 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
876979c34c
commit
93243fdba2
|
@ -1,4 +1,9 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.socialnetworking.social-util-library.1-3-0"
|
||||
date="2017-12-31">
|
||||
<Change>Fixed regex for hashtags (#10700)
|
||||
</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.socialnetworking.social-util-library.1-2-1"
|
||||
date="2017-11-13">
|
||||
<Change>Fixed regex for urls (#10234)
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.socialnetworking</groupId>
|
||||
<artifactId>social-util-library</artifactId>
|
||||
<version>1.2.1-SNAPSHOT</version>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<name>social-util-library</name>
|
||||
<description>
|
||||
The social-util-library contains utility functions that can be used by the social-networking portlets.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -7,7 +7,9 @@ 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 and https://www.local.it/#here";
|
||||
String text = "Dear members, The item 'ADSDTest4CWP' has been just published by Leonardo Candela. " +
|
||||
"You can find it here: http://data.d4science.org/ctlg/CWP_Secretariat/adsdtest4cwp " +
|
||||
"#Area #Geospatial #Periodicity-When_updates_are_available ";
|
||||
List<String> hashtags = Utils.getHashTags(text);
|
||||
System.out.println("Hashtags are " + hashtags);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue