• 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
  • findpath ';' REGEX ( ';' REPLACE )?

    Prev Next
    Project
    Find bundle resources by full path with optional regex replacement

    Summary

    The findpath macro finds resources in the current bundle by matching full resource paths against a regular expression, with optional replacement to transform the results.

    Syntax

    ${findpath[;<regex>[;<replacement>]]}
    

    Parameters

    • regex (optional) - Regular expression to match full paths (default: “.*” matches all)
    • replacement (optional) - Replacement pattern using regex groups (e.g., “$1”)

    Behavior

    • Searches bundle resources by full path
    • Matches entire path against regex pattern
    • Optionally applies replacement to matched paths
    • Returns comma-separated list of results

    Examples

    Find all resources:

    ${findpath}
    # Returns full paths of all resources
    

    Find by path pattern:

    ${findpath;META-INF/.*\.xml}
    # Returns XML files (full path) in META-INF/
    

    Extract path components:

    ${findpath;com/example/(.*)/.*\.class;$1}
    # Returns middle package component
    

    Find and transform:

    ${findpath;src/(.*)\.java;$1}
    # Returns paths without src/ prefix and .java extension
    

    Use Cases

    • Resource discovery by path
    • Full path pattern matching
    • Path transformation
    • Bundle content analysis
    • Package structure extraction

    Notes

    • Matches full resource path, not just filename
    • Uses Java regex syntax
    • See also: ${findname} for filename-only matching
    • See also: ${lsr} for file system searches

    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home