Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39188 > unrolled thread
| Started by | chad altenburg <cdalten@gmail.com> |
|---|---|
| First post | 2019-11-27 05:32 -0800 |
| Last post | 2019-11-27 23:41 +0000 |
| Articles | 14 — 4 participants |
Back to article view | Back to comp.lang.java.programmer
Because ramine plugging comp.programming with spam.... chad altenburg <cdalten@gmail.com> - 2019-11-27 05:32 -0800
Re: Because ramine plugging comp.programming with spam.... Martin Gregorie <martin@mydomain.invalid> - 2019-11-27 13:47 +0000
Re: Because ramine plugging comp.programming with spam.... chad altenburg <cdalten@gmail.com> - 2019-11-27 05:59 -0800
Re: Because ramine plugging comp.programming with spam.... Martin Gregorie <martin@mydomain.invalid> - 2019-11-27 15:02 +0000
Re: Because ramine plugging comp.programming with spam.... Arne Vajhøj <arne@vajhoej.dk> - 2019-11-27 18:22 -0500
Re: Because ramine plugging comp.programming with spam.... Martin Gregorie <martin@mydomain.invalid> - 2019-11-27 23:38 +0000
Re: Because ramine plugging comp.programming with spam.... Arne Vajhøj <arne@vajhoej.dk> - 2019-11-27 20:26 -0500
Re: Because ramine plugging comp.programming with spam.... chad altenburg <cdalten@gmail.com> - 2019-11-28 08:15 -0800
Re: Because ramine plugging comp.programming with spam.... chad altenburg <cdalten@gmail.com> - 2019-12-10 10:28 -0800
Re: Because ramine plugging comp.programming with spam.... chad altenburg <cdalten@gmail.com> - 2019-12-10 10:29 -0800
Re: Because ramine plugging comp.programming with spam.... Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-11-27 20:09 +0100
Re: Because ramine plugging comp.programming with spam.... Arne Vajhøj <arne@vajhoej.dk> - 2019-11-27 18:23 -0500
Re: Because ramine plugging comp.programming with spam.... Arne Vajhøj <arne@vajhoej.dk> - 2019-11-27 18:31 -0500
Re: Because ramine plugging comp.programming with spam.... Martin Gregorie <martin@mydomain.invalid> - 2019-11-27 23:41 +0000
| From | chad altenburg <cdalten@gmail.com> |
|---|---|
| Date | 2019-11-27 05:32 -0800 |
| Subject | Because ramine plugging comp.programming with spam.... |
| Message-ID | <64859ebd-4194-4b36-ae6b-80135a519db2@googlegroups.com> |
This is sort of Java related. This is about searching for a word in a Java using regex. I have the word "AlarmService". 1)searching for "alarm" produces "AlarmService" 2)searching for "alarmS" produces nothing 3)searching for "AlarmS" produces "AlarmService" The question is how come having a lowercase in "a" in 1 produces the entire word while the lowercase "a" in 2 doesn't? Ie, I have to change it uppercase in order to get the correct result.
[toc] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2019-11-27 13:47 +0000 |
| Message-ID | <qrlupk$7r7$1@dont-email.me> |
| In reply to | #39188 |
On Wed, 27 Nov 2019 05:32:25 -0800, chad altenburg wrote: > The question is how come having a lowercase in "a" in 1 produces the > entire word while the lowercase "a" in 2 doesn't? Ie, I have to change > it uppercase in order to get the correct result. > What program are you using to do the search? Which family of regexes does it use? The regexes used by grep and awk differ from Perl regexes, which in turn are different from Java regexes. -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | chad altenburg <cdalten@gmail.com> |
|---|---|
| Date | 2019-11-27 05:59 -0800 |
| Message-ID | <f507ddcf-f390-43d2-871f-bb2dcd1586c0@googlegroups.com> |
| In reply to | #39189 |
On Wednesday, November 27, 2019 at 5:47:43 AM UTC-8, Martin Gregorie wrote: > On Wed, 27 Nov 2019 05:32:25 -0800, chad altenburg wrote: > > > The question is how come having a lowercase in "a" in 1 produces the > > entire word while the lowercase "a" in 2 doesn't? Ie, I have to change > > it uppercase in order to get the correct result. > > > What program are you using to do the search? > > Which family of regexes does it use? > > The regexes used by grep and awk differ from Perl regexes, which in turn > are different from Java regexes. > I'm using the Java IDE that comes with Android Studio for Windows 10.
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2019-11-27 15:02 +0000 |
| Message-ID | <qrm36q$st3$1@dont-email.me> |
| In reply to | #39190 |
On Wed, 27 Nov 2019 05:59:56 -0800, chad altenburg wrote: > On Wednesday, November 27, 2019 at 5:47:43 AM UTC-8, Martin Gregorie > wrote: >> On Wed, 27 Nov 2019 05:32:25 -0800, chad altenburg wrote: >> >> > The question is how come having a lowercase in "a" in 1 produces the >> > entire word while the lowercase "a" in 2 doesn't? Ie, I have to >> > change it uppercase in order to get the correct result. >> > >> What program are you using to do the search? >> >> Which family of regexes does it use? >> >> The regexes used by grep and awk differ from Perl regexes, which in >> turn are different from Java regexes. >> >> > I'm using the Java IDE that comes with Android Studio for Windows 10. > If the IDE is written in Java, hopefully it will be using standard Java regexes and so should work as described in the Javadocs for the Pattern and Matcher classes. I had a quick scan of the Javadoc pages but didn't see any references to the case sensitivity you describe, but may have missed it. The other possibility is that Android Studio just a reconfigured or tweaked version of Windows 10 Visual Studio, in which case you need to look at its manual to see how its regexes work. If that's the case I can't help any further since I haven't used Windows since 2003. -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2019-11-27 18:22 -0500 |
| Message-ID | <qrn0f1$1j9a$1@gioia.aioe.org> |
| In reply to | #39192 |
On 11/27/2019 10:02 AM, Martin Gregorie wrote: > On Wed, 27 Nov 2019 05:59:56 -0800, chad altenburg wrote: > >> On Wednesday, November 27, 2019 at 5:47:43 AM UTC-8, Martin Gregorie >> wrote: >>> On Wed, 27 Nov 2019 05:32:25 -0800, chad altenburg wrote: >>> >>>> The question is how come having a lowercase in "a" in 1 produces the >>>> entire word while the lowercase "a" in 2 doesn't? Ie, I have to >>>> change it uppercase in order to get the correct result. >>>> >>> What program are you using to do the search? >>> >>> Which family of regexes does it use? >>> >>> The regexes used by grep and awk differ from Perl regexes, which in >>> turn are different from Java regexes. >>> >>> >> I'm using the Java IDE that comes with Android Studio for Windows 10. >> > If the IDE is written in Java, hopefully it will be using standard Java > regexes and so should work as described in the Javadocs for the Pattern > and Matcher classes. I had a quick scan of the Javadoc pages but didn't > see any references to the case sensitivity you describe, but may have > missed it. > > The other possibility is that Android Studio just a reconfigured or > tweaked version of Windows 10 Visual Studio, in which case you need to > look at its manual to see how its regexes work. If that's the case I > can't help any further since I haven't used Windows since 2003. Android Studio is a special bundled & badged IntelliJ IDEA. Arne
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2019-11-27 23:38 +0000 |
| Message-ID | <qrn1d2$nb1$1@dont-email.me> |
| In reply to | #39194 |
On Wed, 27 Nov 2019 18:22:10 -0500, Arne Vajhøj wrote: > > Android Studio is a special bundled & badged IntelliJ IDEA. > So, is it a Java application? I last used a copy several years ago in Win XP days, so around 2005, but I didn't install the copy I used and don't recall what it was written in. -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2019-11-27 20:26 -0500 |
| Message-ID | <qrn7o4$imm$1@gioia.aioe.org> |
| In reply to | #39197 |
On 11/27/2019 6:38 PM, Martin Gregorie wrote: > On Wed, 27 Nov 2019 18:22:10 -0500, Arne Vajhøj wrote: >> Android Studio is a special bundled & badged IntelliJ IDEA. >> > So, is it a Java application? > > I last used a copy several years ago in Win XP days, so around 2005, but > I didn't install the copy I used and don't recall what it was written in. It is a common IDE for Java development. It is itself a JVM application using Swing as GUI framework. Original all Java code but today a mix of Java code and Kotlin code. Arne
[toc] | [prev] | [next] | [standalone]
| From | chad altenburg <cdalten@gmail.com> |
|---|---|
| Date | 2019-11-28 08:15 -0800 |
| Message-ID | <35da07c3-635c-4963-bd13-4c22b8eae31f@googlegroups.com> |
| In reply to | #39199 |
I'll recreate the problem tomorrow. Because by me, it's Thanksgiving. As a result, everything has come to a halt in the name of turkey.
[toc] | [prev] | [next] | [standalone]
| From | chad altenburg <cdalten@gmail.com> |
|---|---|
| Date | 2019-12-10 10:28 -0800 |
| Message-ID | <6a960a8e-c5fe-4a33-b924-5e5f823246b9@googlegroups.com> |
| In reply to | #39200 |
On Thursday, November 28, 2019 at 8:15:48 AM UTC-8, chad altenburg wrote: > I'll recreate the problem tomorrow. Because by me, it's Thanksgiving. As a result, everything has come to a halt in the name of turkey. I take that back, I can't because I got drunk and accidently dropped my laptop in the toilet. I'll repost once I get it back up and running.
[toc] | [prev] | [next] | [standalone]
| From | chad altenburg <cdalten@gmail.com> |
|---|---|
| Date | 2019-12-10 10:29 -0800 |
| Message-ID | <66f3bc72-69c1-455b-bf32-cd41c494214d@googlegroups.com> |
| In reply to | #39200 |
On Thursday, November 28, 2019 at 8:15:48 AM UTC-8, chad altenburg wrote: > I'll recreate the problem tomorrow. Because by me, it's Thanksgiving. As a result, everything has come to a halt in the name of turkey. And if you are wondering how I'm posting, look at my IP. It corresponds to UC Berkeley. This is because I'm using the university computers -_-.
[toc] | [prev] | [next] | [standalone]
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
|---|---|
| Date | 2019-11-27 20:09 +0100 |
| Message-ID | <qrmhle$fe$1@dont-email.me> |
| In reply to | #39188 |
On 2019-11-27 14:32, chad altenburg wrote: > This is sort of Java related. > > This is about searching for a word in a Java using regex. > > I have the word "AlarmService". > > 1)searching for "alarm" produces "AlarmService" > > 2)searching for "alarmS" produces nothing > > 3)searching for "AlarmS" produces "AlarmService" > > The question is how come having a lowercase in "a" in 1 produces the entire word > while the lowercase "a" in 2 doesn't? Ie, I have to change it uppercase in order to get the correct result. > > This is about searching for a word in a Java using regex. Is it really? > I'm using the Java IDE that comes with Android Studio for Windows 10. I'm using IntelliJ. So not the same IDE, but perhaps the same mechanism. IntelliJ has a nifty function when it comes to searching for items (files, classes, etc.). If your input string is all lowercase, it returns any item that starts with that input, ignoring case. But if you start mixing uppercase in the input, it performs a sort of extremely useful camel-case search, in which "AS" and "AlS" will match both "AlarmService" and "AluminumSwingSet", but "AlSe" will match only "AlarmService" (of the two, at least). Which doesn't have anything to do with regexes, per se. -- DF.
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2019-11-27 18:23 -0500 |
| Message-ID | <qrn0gr$1j9a$2@gioia.aioe.org> |
| In reply to | #39193 |
On 11/27/2019 2:09 PM, Daniele Futtorovic wrote: >> I'm using the Java IDE that comes with Android Studio for Windows 10. > > I'm using IntelliJ. So not the same IDE, but perhaps the same mechanism. Android Studio is based on IntelliJ IDEA so almost same IDE. Arne
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2019-11-27 18:31 -0500 |
| Message-ID | <qrn10f$1lhd$1@gioia.aioe.org> |
| In reply to | #39188 |
On 11/27/2019 8:32 AM, chad altenburg wrote:
> This is sort of Java related.
>
> This is about searching for a word in a Java using regex.
>
> I have the word "AlarmService".
>
> 1)searching for "alarm" produces "AlarmService"
>
> 2)searching for "alarmS" produces nothing
>
> 3)searching for "AlarmS" produces "AlarmService"
>
> The question is how come having a lowercase in "a" in 1 produces the entire word
> while the lowercase "a" in 2 doesn't? Ie, I have to change it uppercase in order to get the correct result.
Could you show some code?
Because I cannot recreate the problem.
import java.util.regex.Pattern;
public class RegexMatch {
public static void test(String needle, String haystack) {
Pattern p = Pattern.compile(needle);
System.out.printf("Standard match %s in %s : %b\n", needle, haystack,
p.matcher(haystack).find());
Pattern pi = Pattern.compile(needle, Pattern.CASE_INSENSITIVE);
System.out.printf("Case insensitive match %s in %s : %b\n", needle,
haystack, pi.matcher(haystack).find());
}
public static void main(String[] args) {
test("alarm", "AlarmService");
test("alarmS", "AlarmService");
test("AlarmS", "AlarmService");
}
}
produces:
Standard match alarm in AlarmService : false
Case insensitive match alarm in AlarmService : true
Standard match alarmS in AlarmService : false
Case insensitive match alarmS in AlarmService : true
Standard match AlarmS in AlarmService : true
Case insensitive match AlarmS in AlarmService : true
which matches my expectations.
Arne
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2019-11-27 23:41 +0000 |
| Message-ID | <qrn1jt$nb1$2@dont-email.me> |
| In reply to | #39196 |
On Wed, 27 Nov 2019 18:31:28 -0500, Arne Vajhøj wrote:
> On 11/27/2019 8:32 AM, chad altenburg wrote:
>> This is sort of Java related.
>>
>> This is about searching for a word in a Java using regex.
>>
>> I have the word "AlarmService".
>>
>> 1)searching for "alarm" produces "AlarmService"
>>
>> 2)searching for "alarmS" produces nothing
>>
>> 3)searching for "AlarmS" produces "AlarmService"
>>
>> The question is how come having a lowercase in "a" in 1 produces the
>> entire word while the lowercase "a" in 2 doesn't? Ie, I have to change
>> it uppercase in order to get the correct result.
>
> Could you show some code?
>
> Because I cannot recreate the problem.
>
> import java.util.regex.Pattern;
>
> public class RegexMatch {
> public static void test(String needle, String haystack) {
> Pattern p = Pattern.compile(needle);
> System.out.printf("Standard match %s in %s : %b\n",
needle, haystack,
> p.matcher(haystack).find());
> Pattern pi = Pattern.compile(needle,
Pattern.CASE_INSENSITIVE);
> System.out.printf("Case insensitive match %s in %s :
%b\n", needle,
> haystack, pi.matcher(haystack).find());
> }
> public static void main(String[] args) {
> test("alarm", "AlarmService");
> test("alarmS", "AlarmService");
> test("AlarmS", "AlarmService");
> }
> }
>
> produces:
>
> Standard match alarm in AlarmService : false Case insensitive match
> alarm in AlarmService : true Standard match alarmS in AlarmService :
> false Case insensitive match alarmS in AlarmService : true Standard
> match AlarmS in AlarmService : true Case insensitive match AlarmS in
> AlarmService : true
>
> which matches my expectations.
>
Thats what the docs for the Pattern class say should happen too.
--
Martin | martin at
Gregorie | gregorie dot org
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web