# Metacharacter looks for alphabetics

See Furst

Greenhorn

Posts: 29

posted 6 years ago

Ok here's the question:

One answer is:

The Learn Key Master Exam maintains that this answer is false because the '.' metacharacter searches for everything that is not a newline.

I would maintain that this true for exactly that reason! Alpha numerics are a subset of the group that this metacharacter searches for. It searches for anything that is not a new line.

So if I'm searching for A and B is a subset of A then it's implied that I am searching for B if B is a member of A.. And if any of you study boolean algebra you would know that if B is included in set A then B -> A.

Here is some proof: Ok so if this statement above is false it means that the statement : "The '.' metacharacter does not search for alphabetic characters" is true

Let's test that out.

Is the code we're gong to use. Now, we have to assume that if something is found by a regular expression pattern, then that pattern is indeed looking for it.

Proof:

Let's take the pattern

Let's modify the code above to do this.

Here is the output:

index 0:

index 1:

index 2:

index 3:

index 4:

index 5: 1232

index 9:

we find that start() is setting the index each time while group() is giving us what we are looking for.. So we know that the ouput of group() is what the expression is looking for.

So then let's run the first code with the '.' metacharacter.

Here is the output:

index 0: O

index 1: C

index 2: J

index 3: P

This means that '.' absolutely searches for alphabetic characters.

I saw this question on one of the practice tests in the Learn Key Master Exam and I canceled my appointment. I'm not going to get certified by people who think that this is good code or even correct in any way.

All of you: You want to prove that you can develop in java.. Get a source forge or github account and write some java code. Not a OCJP certificate.

You'll be a better programmer for it too.

Which are true about java regex

One answer is:

The '.' metacharacter searches for alphabetic characters

The Learn Key Master Exam maintains that this answer is false because the '.' metacharacter searches for everything that is not a newline.

I would maintain that this true for exactly that reason! Alpha numerics are a subset of the group that this metacharacter searches for. It searches for anything that is not a new line.

So if I'm searching for A and B is a subset of A then it's implied that I am searching for B if B is a member of A.. And if any of you study boolean algebra you would know that if B is included in set A then B -> A.

Here is some proof: Ok so if this statement above is false it means that the statement : "The '.' metacharacter does not search for alphabetic characters" is true

Let's test that out.

Is the code we're gong to use. Now, we have to assume that if something is found by a regular expression pattern, then that pattern is indeed looking for it.

Proof:

Let's take the pattern

*\d**. This example is in one of the self tests in Sierra and Bates' book, actually. If we are given the string 'abdrf1232' , what would the result be? We know that the expression is looking for 0 or more digits. So, it's looking for digits.Let's modify the code above to do this.

Here is the output:

index 0:

index 1:

index 2:

index 3:

index 4:

index 5: 1232

index 9:

we find that start() is setting the index each time while group() is giving us what we are looking for.. So we know that the ouput of group() is what the expression is looking for.

So then let's run the first code with the '.' metacharacter.

Here is the output:

index 0: O

index 1: C

index 2: J

index 3: P

This means that '.' absolutely searches for alphabetic characters.

I saw this question on one of the practice tests in the Learn Key Master Exam and I canceled my appointment. I'm not going to get certified by people who think that this is good code or even correct in any way.

All of you: You want to prove that you can develop in java.. Get a source forge or github account and write some java code. Not a OCJP certificate.

You'll be a better programmer for it too.

Doin' Java to be one of the cool kids.

I usually use Perl;