SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Super Member
    Join Date
    Sep 2007
    Location
    Chennai, Tamil nadu, India
    Posts
    1,004
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    String Replace not working

    DateReceived - \/Date(-62135596800000)\/
    Required String - /Date(-62135596800000)/

    Tried Methods

    Custom Jmeter function

    ${__strReplace(${DateReceived},\,,)} - Its giving the same value

    Beanshel pre processor

    String str = vars.get("DateReceived");
    String rts = str.replaceAll("\", "");
    vars.put("trs",rts);

    Error Message

    WARN - jmeter.protocol.java.sampler.BSFSampler: BSF error org.apache.bsf.BSFException: The application script threw an exception: java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
    \
    ^ BSF info: script at line: 0 column: columnNo
    at bsh.util.BeanShellBSFEngine.eval(BeanShellBSFEngin e.java:193)
    at org.apache.jmeter.protocol.java.sampler.BSFSampler .sample(BSFSampler.java:98)
    at org.apache.jmeter.threads.JMeterThread.executeSamp lePackage(JMeterThread.java:465)
    at org.apache.jmeter.threads.JMeterThread.processSamp ler(JMeterThread.java:410)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterT hread.java:241)
    at java.lang.Thread.run(Unknown Source)

    I have tried with four back slashes, but not working.
    Experts please help me to solve this issue.

    Thanks...
    Last edited by prince3105; 02-07-2017 at 05:33 AM.

  2. #2
    Member
    Join Date
    Oct 2013
    Posts
    120
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    In case of JMeter functions you should be escaping commas. Moreover, you need to escape backslashes as well.

    Example __BeanShell function would look like:

    Code:
    ${__BeanShell(vars.get("DateReceived").replaceAll("\\\\\\\"\,""),)}
    Demo:


  3. #3
    Super Member
    Join Date
    Sep 2007
    Location
    Chennai, Tamil nadu, India
    Posts
    1,004
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Thank you... its working
    i have never seen bugs sleeping

 

 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 11:39 AM.

Copyright BetaSoft Inc.