• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Getting Started
      • Introduction
      • How to install bnd
      • Guided Tour Workspace & Projects
      • bnd / bndlib Features and JAR Wrapping Techniques
      • FAQ - Frequently Asked Questions
    • Concepts and Practices
      • Concepts
      • Background
      • Best practices
    • Build and Development
      • Build
      • Generating JARs
      • Versioning
      • Baselining
      • Service Components
      • Metatype
      • Contracts
      • Bundle Annotations
      • Accessor Properties
      • SPI Annotations
    • Dependency and Launching
      • Resolving Dependencies
      • Launching
      • Startlevels
    • Testing
      • Testing
      • Testing with Launchpad
    • Packaging and Distribution
      • Packaging Applications
      • JPMS Libraries
      • Wrapping Libraries to OSGi Bundles
    • Documentation and Tools
      • Generating Documentation
      • bnd CLI Commands
      • For Developers
      • Templates for Workspaces
      • Tips for Windows users
      • Tools bound to bnd
    • Reference Material
      • Reference
      • Headers
      • Instruction Reference
      • Instruction Index
      • Macro Reference
      • Macro Index
      • Plugins
      • External Plugins
    • Configuration and Troubleshooting
      • Settings
      • Errors
      • Warnings
  • split ';' REGEX (';' STRING )*

    Prev Next
    Macro
    Split strings into a list using a regular expression

    Summary

    The split macro splits one or more strings into a list using a regular expression as the delimiter. Empty segments are filtered out.

    Syntax

    ${split;<regex>[;<string>...]}
    

    Parameters

    • regex - Regular expression pattern to split on
    • string - One or more strings to split

    Behavior

    • Splits each string using the regex pattern
    • Filters out empty segments
    • Combines results from all strings
    • Returns comma-separated list

    Examples

    Split on comma:

    ${split;,;red,green,blue}
    # Returns: "red,green,blue"
    

    Split on whitespace:

    ${split;\s+;one two  three   four}
    # Returns: "one,two,three,four"
    

    Split on pipe:

    ${split;\|;apple|banana|cherry}
    # Returns: "apple,banana,cherry"
    

    Split multiple strings:

    ${split;:;path1:path2;path3:path4}
    # Returns: "path1,path2,path3,path4"
    

    Split path on separator:

    ${split;${pathseparator};${some.path}}
    

    Use Cases

    • Parsing delimited strings
    • Breaking paths into components
    • Processing formatted data
    • Converting between delimiter formats
    • Extracting list elements from strings

    Notes

    • Uses Java regex syntax
    • Empty segments are automatically filtered
    • Multiple input strings are processed
    • See also: ${join} and ${sjoin} for combining
    • See also: ${filter} for pattern-based filtering

    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home