Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro Java
|
Pro Java Expert level Java questions not about a specific book. Please indicate your version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 10th, 2007, 12:03 AM
Registered User
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Regular Expression matching sub string

RegExp is new to me!
I have a string which contains few commas that the number/place of the commas are not predictable.
I need the substring that begins from the 5th comma from the end, and forward.

example:
full string:
  OU=Praklitim,OU=Sanegoria,OU=JR-Maatz,OU=OUs,DC=justice,DC=gov,DC=il
substring:
  OU=JR-Maatz,OU=OUs,DC=justice,DC=gov,DC=il

Thank you,
Maya.
 
Old May 23rd, 2007, 09:58 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

Even i am new to regular expressions, i must say i cant write regular expressions. But i found few links which may help you.

http://en.allexperts.com/q/Javascrip...string-aaa.htm
http://www.4guysfromrolla.com/webtech/090199-1.shtml
http://www.codeguru.com/Cpp/Cpp/stri...cle.php/c2779/
http://www.evolt.org/article/Regular...ript/17/36435/
http://www.insidedhtml.com/tips/func...ts23/page1.asp

Hope you get some usefull info from these links.

Regards,
Rakesh
 
Old May 29th, 2007, 12:33 AM
Registered User
 
Join Date: May 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
  you can simply use
   in java
String str[]=stingName.split(",");
  for(int i=0;i<str.length;i++) {}
in javascript
var strarr=stingName.split(",");
  and then read that array in loop
   for(i=0;i<strarr.length;i++)
    {}

 
Old August 8th, 2007, 05:32 AM
Authorized User
 
Join Date: Oct 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://p2p.wrox.com/topic.asp?TOPIC_ID=60163

Best,
Anna





Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular expressions and string matching DennyLoi Java Basics 0 November 15th, 2007 01:37 PM
converting a string to regular expression swarnap Javascript How-To 1 November 14th, 2006 04:33 AM
Regular expression to select non-matching pattern Neuron BOOK: Beginning Regular Expressions 1 June 12th, 2006 10:06 AM
Regualr Expression Password Matching Chandra Paladugu VB.NET 1 March 24th, 2006 08:32 PM
Regualr Expression Password Matching Chandra Paladugu C# 1 March 2nd, 2006 04:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.