aspose file tools
The moose likes Beginning Java and the fly likes regarding regex syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "regarding regex syntax" Watch "regarding regex syntax" New topic
Author

regarding regex syntax

Marcus Deviln
Ranch Hand

Joined: Jan 29, 2009
Posts: 39
Let's say you have some regex metadata with a conversion character like d. What is the purpose of the digits or integers that we sometimes see directly preceding the conversion character?(example: "%*4d/d" )


+Deviln+ The power of JAVA compels you!
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16692
    
  19

Marcus Deviln wrote:Let's say you have some regex metadata with a conversion character like d. What is the purpose of the digits or integers that we sometimes see directly preceding the conversion character?(example: "%*4d/d" )



Regex metadata? Conversion character? Can you first explain to us what you mean?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That looks more like a printf formatter.
Siddhesh Deodhar
Ranch Hand

Joined: Mar 05, 2009
Posts: 117
+ 1 with David. Marcus, can you post your problem/requirement in detail?


Good, Better, Best, Don't take rest until, Good becomes Better, and Better becomes Best.
Sidd : (SCJP 6 [90%] )
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32675
    
    4
Look at the Formatter class or these sections in the Java™ Tutorials: 1 2 and 3. I can't seem to find the * character in Formatter, however. Are you sure about that?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3011
    
    9
Campbell Ritchie wrote:Look at the Formatter class or these sections in the Java™ Tutorials: 1 2 and 3. I can't seem to find the * character in Formatter, however. Are you sure about that?


Maybe it's not supported in Java, but in C, the '*' character allows you to specify the field width in the argument list

From the MS C++ docs
The second optional field of the format specification is the width specification. The width argument is a nonnegative decimal integer controlling the minimum number of characters printed.... If the width specification is an asterisk (*), an int argument from the argument list supplies the value.


Joanne
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32675
    
    4
Joanne Neal wrote: . . . Maybe it's not supported in Java, but in C, . . .
No, it's not supported in Java, but thank you, Joanne. I had never seen that, not in the little C I have written.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regarding regex syntax
 
Similar Threads
Patter and Matcher..Mock Question Doubt
why java doesnt allow "\" ?
regExp matcher not working
Struts2 Regex Validation killing me, Please help
JDk 1.5 regex utility