Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account
List archives

Re: Confusion with Regex

Alphebetical counter
(24 lines)
Re: Jmeter providing bad results
(11 lines)
Aug 20, 2010
Kbutler
Kbutler
Are you sure your variable name(s) are not declared elsewhere in your test
plan?

Might be a dumb question, but I've used the RegexExtractor for a long time
w/o issue.  How are you getting your multiple values out?



Reply
Tags: valuesmultipleissue
Messages in this thread
Re: Confusion with Regex
reply Re: Confusion with Regex
(26 lines) Aug 20, 2010 20:23
Similar Threads
Confusion reigns....

I'm looking at the access control information on page:


http://sling.apache.org/site/managing...ccessmanager.html


I opened my text file, created a file that had a line of text and wrote
that file out on the webdav mount sling repository.

The url for the node is:

http://localhost:8080/sling/content/simpleNode

If I hit it with this url:

http://localhost:8080/sling/content/simpleNode.txt

with  Firefox 3.6.8, 
Chrome 5.0.375.125,
Safari Version 5.0 (6533.16) 
and curl

I get the same thing in each. 

However, if I hit his url:

http://localhost:8080/sling/content/simpleNode.acl.json

With those that same URL I get 404 errors in all but chrome, 
and what I think should be the correct response, an empty ACL,  
from Chrome.

Any idea why I get such different responses?


Tony

variable confusion
Why can't variables be reassigned with a setup like this?

node /.*mydomain.com/ {
  import mydomain.pp
}

node /*.yourdomain.com/ {
  import yourdomain.pp
}

In manifest mydomain.pp and yourdomain.pp I have variables that are
specific
to that site that I want to import only for that site (ie, dns_nameserver
ldap_server).  I get errors that variable cannot be reassigned.  My
reasoning for wanting to separate everything into separate site specific
manifests is mostly because my nodes.pp is getting way too cluttered and
difficult to manage (over 1k lines of code).  It looks like stuff is
getting
imported regardless of the node type (case statements also show the same
behavior).

err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Cannot reassign variable site_id at
/etc/puppet/manifests/nodes/mydomain.pp:5 on node host.yourdomain.com





Post-1.0 version confusion
Hi,

I'm currently running 0.10.1 and am looking to upgrade to the latest
stable
build. The notice on the downloads page (
http://couchdb.apache.org/downloads.html) says to wait for 1.0.1, but I
see
that 0.11.2 came out today. Are they equivalent? Also, the Ubuntu download
links on couch.io (http://www.couch.io/get#ubuntu) use the version number
"1.0.0_2" in their filenames. Is this the same as 0.11.2? Are these builds
updated to avoid the issue 1.0.0 had?

What's the latest stable version I should be using?

On another note, I tried using the 0.11.2 build and am now getting this
error when starting couchdb: http://gist.github.com/519916. Any hints? I
have a really difficult time getting any useful information out of these
Erlang stack traces.

Thanks!

- Garret


Confusion about How KahaDB works !!!
Hi,

I'm confused and try to understand How ActiveMq works with KahaDB. My
activemq broker 5.3.0 is configured to be non persistent

and messages send are also delivered as NON persistent but KhaDB files
growths !!

This is strange as normally, only files should be created under
tmp_storage 

There is something that I or we don't understand

I send 1.000.000 messages to thousands of topics (consumer for the topics
are listening) and here is what I see in KahaDb folder

Size of files

db-1.log : 32 256 KB
db.data : 120 576 KB
db.redo : 2630 KB

Folder tmp_storage is desperately empty

KR,



-----
Charles Moulliard
SOA Architect

My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
 




Install copies sources jar instead of class jar, confusion?
Need help deciding whether I've found an an error in an original .pom
file,
or in the ivy translation, or just me being rubbish (favourite)...

I'm installing a project jena
(http://repo2.maven.org/maven2/com/hp/hpl/jena/jena/2.6.3/) to a local
repository, one of the dependencies in the generated jena ivy file (on the
iri 0.8 version project) declares an artifact of that projects source
files
as so -->

<dependency org="com.hp.hpl.jena" name="iri" rev="0.8" force="true"
conf="compile->compile(*),master(*);runtime->runtime(*)">
  <artifact name="iri" type="jar" ext="jar" conf=""
m:classifier="sources" />
  </dependency>

When this runs in a bog-standard 'install' it copies only the
iri-0.8-sources.jar (rather than the iri-0.8.jar and javadocs i want as
well). I end up having to run a separate install on this project to grab
all
the artifacts in it. 

The original jena .pom file has two entries for iri-0.8, one for the class
files in a jar and one for the sources, which declares a 'sources'
classifier which is carried through faithfully to the ivy file. However, I
would have thought ivy would have generated a type other than 'jar' for
the
sources (even though the sources file comes in a jar, I guess that is
covered by 'ext="jar"'). The documentation would seem to indicate type
should be 'source'.. this seems to be my stumbling block, it thinks it's
getting me the jar file with the compiled classes in it when it's in fact
the sources.




install grabs sources rather than classes jar - confusion?
Need help deciding whether I've found an an error in an original .pom
file,
or in the ivy translation, or just me being rubbish (favourite)... 

I'm installing a project jena
(http://repo2.maven.org/maven2/com/hp/hpl/jena/jena/2.6.3/) to a local
repository, one of the dependencies in the generated jena ivy file (on the
iri 0.8 version project) declares an artifact of that projects source
files
as so --> 

<dependency org="com.hp.hpl.jena" name="iri" rev="0.8" force="true"
conf="compile-compile(*),master(*);runtime->runtime(*)">
<artifact name="iri" type="jar" ext="jar" conf=""
m:classifier="sources"
/>
</dependency>
This is in addition to a 'normal' dependency for the iri project which
should scoop up the iri-0.8.jar file with the compiled classes in

When jena's ivy file is processed by a bog-standard 'install' it copies
only
the iri-0.8-sources.jar (rather than the iri-0.8.jar and javadocs i want
as
well). I end up having to run a separate install on this project to grab
all
the artifacts in it. 

The original jena .pom file has two entries for iri-0.8, one for the class
files in a jar and one for the sources, which declares a 'sources'
classifier which is carried through faithfully to the ivy file. However, I
would have thought ivy would have generated a type other than 'jar' for
the
sources (even though the sources file comes in a jar, I guess that is
covered by 'ext="jar"'), as this is the type for the classes jar as well.
The documentation would seem to indicate type should be 'source'.. this
seems to be my stumbling block, it thinks it's getting me the jar file
with
the compiled classes in it when it's in fact the sources.
ivy version is 2.1.0, running through ant 1.8.0




Using Regex
All,

 

I am using pig embedded in Java and need to use matches in my pig job.
However when I try to use escape characters in the pig line, the
compiler complains. How do I use complex regex while embedding?

 

Sample code that is throwing errors:

 

myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
'\Q34.21.12.*\E';");

 

error: invalid escape sequence.

 

Thanks,

 

Matt

 



Flow control, memory limits and persistent store confusion
We've set up AMQ to persist all messages:

<broker xmlns="http://activemq.apache.org/schema/core"
        brokerName="localhost"
        useJmx="true"
        persistent="true">

    <persistenceAdapter>
      <amqPersistenceAdapter directory="/foo"/>
    </persistenceAdapter>


We are using flow control for all queues (13 of them):
<policyEntry queue=">" producerFlowControl="true"
memoryLimit="10mb"/>

System usage is set as follows:

  <systemUsage>
      <systemUsage>
        <memoryUsage>
          <memoryUsage limit="180 mb"/>
        </memoryUsage>
        <storeUsage>
          <storeUsage limit="3 gb" name="plos-queue"/>
        </storeUsage>
        <tempUsage>
          <tempUsage limit="100 mb"/>
        </tempUsage>
      </systemUsage>
    </systemUsage>

We have slow consumers and messages are sent in bursts of about 20,000.
I was expecting, since we persist all the messages, that I should be
able to put all 20k of them in the queue quickly and have consumers
slowly work on them.

Instead, it looks like none of the queues can have more than 140-150
messages at the time and flow control is making producer wait. It's like
queues are limited by the number of messages they can have in those 10m
of memory. Aren't persistent messages limited by store size ?

How do I achieve what I want ? 

What would be a consequence in turning off flow control ?

Thanks




Using variables in regex
Well, how do I use the content of a variable in regex?

$username = "user1"
file {  "userdata.tar.bz2":
                source => "puppet://$server/modules/$module/
userdata.tar.bz2",
                ensure => $users ? {
                                /$username/ => absent,
                                default => present,
                        },
}

$users is a custom fact that contains all local users:

users => at avahi bin daemon dnsmasq ftp games haldaemon lp mail
messagebus nobody ntp polkituser postfix pulse root sshd suse uuidd
wwwrun man news uucp puppet user1

When I hardcode "user1" into the regex my test works fine and the file
is removed.

But things like /$variable/ or /\$variable/ or /#{variable}/ just
don't work.
Is it even possible in version 0.25.4?





Ask a question about regex in CRS
Hi, everyone
    The following rule comes from
rules/base_rules/modsecurity_crs_41_sql_injection_attacks.conf , but I
don't understand what does the regular expression "(?:[\\\(\)\%#]|--)"
mean. What's the meaning of "\%" in a regex?

SecRule MATCHED_VAR "(?:[\\\(\)\%#]|--)"
        
"t:none,setvar:'tx.msg=%{rule.msg}',setvar:tx.sql_injection_score=+%{tx.critical_anomaly_score},setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},setvar:tx.%{rule.id}-WEB_ATTACK/SQL_INJECTION-%{matched_var_name}=%{tx.0}"


Multiline regex matches
Hi,

I need to fail a build if a certain file doesn't match a certain
multiline regex pattern. I tried somethink like

    <fail>
        <condition>
            <resourcecount when="equal" count="0">
                <restrict>
                    <fileset file="${file}"/>
                    <containsregexp expression="${regex}"/>
                </restrict>
            </resourcecount>
        </condition>
    </fail>

but unfortunately containsregexp doesn't perform multiline matches.
Specifying "(?m:${regex})" doesn't work.

If the <matches> condition would support resources, I could use
that,
but it only supports the string attribute.

Any other ideas?

-- Niklas Matthies


Issues with Node Regex

I am trying to match groups of nodes - i.e.

Node: synd1-path2.path2.some.domain
Node: synd2-path2.path2.some.domain

By using either of the node definitions below:

node /^synd\w+\.path2\.some\.domain$/ {
    include ibapps
    include db
}


Using Regex in Embedded Pig in Java
All,

 

I am using pig embedded in Java and need to use matches in my pig job.
However when I try to use escape characters in the pig line, the
compiler complains. How do I use complex regex while embedding?

 

Sample code that is throwing errors:

 

myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
'\Q34.21.12.*\E';");

 

error: invalid escape sequence.

 

Thanks,

 

Matt



A question about android regex implementation
Hi  Jesse and All,
I have written some simple benchmarks for harmony regex and find the
performance of harmony is poor compared to RI. For example, Mathcer.find()
only reach 60% of that of RI. I heard Android use icu4jni re-implement
this
module. Since icu4jni use native code I think it may has higher
performance
than harmony. I am trying to use icu4jni as the back-end of harmony regex
but find icu4jni has no functions related to regex operations.
I know there are some android guys in our community. So can anyone tell me
some detail info for android's regex, like if it re-implement the regex
logic using native code by android itself rather than icu4jni and really
get
higher performance compared to harmony regex? Thanks a lot!


client-side password validation using regex
Hi all,

I was wondering if it's possible to validate a <html:password> field
on client-side by using a regular expression.
A look at validateMask.js told me that the only field types supported are
'hidden', 'text', 'textarea' and 'file'.

Code:

            if ((field.type == 'hidden' ||
                field.type == 'text' ||
                 field.type == 'textarea' ||
                                 field.type == 'file') &&
                 (field.value.length > 0)) {

                if (!jcv_matchPattern(field.value, oMasked[x][2]("mask")))
{
                    if (i == 0) {
                        focusField = field;
                    }
                    fields[i++] = oMasked[x][1];
                    isValid = false;
                }
            }


Is this the exspected behavior? Is there any reason for not supporting
'password' fields?
If so, how would I validate a password field by using a regex (without
changing the js file on my own :))?

Cheers,


Ref. 324 * Geoinformationszentrum
Tel. 0211 9449-6310 * Fax: 0211 9449-6610
Email: stephan.### @it.nrw.de<mailto:stephan.k### @it.nrw.de>



REGEX - Long running thread - stuck at RE.java
Hi,

 

We are facing high CPU usage in our application hosted on Tomcat. After
getting thread dumps, I see the following information. Seems like the
RE.java is getting processed continuously and due to this few threads in
Tomcat are stuck forever. This pushes the CPU usage above 90% and making
the application very unstable. 

 

Please advice.

 

Below is the info from thread dump:

 

TP-Processor5396" daemon prio=10 tid=0x022cff28 nid=0x1f91b runnable
[0x4dcfb000..0x4dcffc70]

            at org.apache.regexp.RE.matchNodes(RE.java:860)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchAt(RE.java:1448)

            at org.apache.regexp.RE.match(RE.java:1498)

            at org.apache.regexp.RE.match(RE.java:1468)

            at org.apache.regexp.RE.match(RE.java:1561)

            at
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

            at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:290)

            at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:206)

            at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:233)

            at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:175)

            at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:128)

            at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:102)

            at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:109)

            at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
86)

            at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)

            at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)

            at
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)

            at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
697)

            at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.
java:889)

            at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:690)

            at java.lang.Thread.run(Thread.java:595)

 

 

Here is the regex related code in our application :

 

        try{

          RE r = new
RE("^[\\w\\-]+(\\.)?[\\w\\-]+@[\\w\\-\\.]+(\\.([a-z]){2,4})$");

          RE r1 = new RE("^\\w{5,65}$");

          match = r.match(userID);

          if(!match)

            match = r1.match(userID);

 

        }catch(Exception ex){

            throw new BusinessException(ex);

        }

 

Any thoughts???? 
 
Do you really need to print this email? Help preserve our environment!
Devez-vous vraiment imprimer ce courriel? Pensons a l'environnement!

Created: (HIVE-1483) Update AWS S3 log format deserializer regex
Update AWS S3 log format deserializer regex