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:
Costantino Perciante 2017-12-14 11:34:20 +00:00
parent 876979c34c
commit 93243fdba2
4 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,9 @@
<ReleaseNotes> <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" <Changeset component="org.gcube.socialnetworking.social-util-library.1-2-1"
date="2017-11-13"> date="2017-11-13">
<Change>Fixed regex for urls (#10234) <Change>Fixed regex for urls (#10234)

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.socialnetworking</groupId> <groupId>org.gcube.socialnetworking</groupId>
<artifactId>social-util-library</artifactId> <artifactId>social-util-library</artifactId>
<version>1.2.1-SNAPSHOT</version> <version>1.3.0-SNAPSHOT</version>
<name>social-util-library</name> <name>social-util-library</name>
<description> <description>
The social-util-library contains utility functions that can be used by the social-networking portlets. The social-util-library contains utility functions that can be used by the social-networking portlets.

View File

@ -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

View File

@ -7,7 +7,9 @@ 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 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); List<String> hashtags = Utils.getHashTags(text);
System.out.println("Hashtags are " + hashtags); System.out.println("Hashtags are " + hashtags);
} }